Order of Trigger Action in traits not correct

G’day all,

The Trigger Action traits don’t follow the standard logic of the traits window. Let me explain further.

I add a Trigger Action trait (Trigger #1) to fire when the keystroke “CTRL H” is pressed. I then add a 2nd Trigger action (Trigger #2) to also fire when the keystroke “CTRL H” is pressed. I also add 2 Report actions to report when each Trigger action fires its next keystroke.

I then placed Trigger #1 above Trigger #2 in the current traits list. Following the standard logic of the traits list, if I press “CTRL H”, Trigger #2 should fire, then Trigger #1. This doesn’t happen.

What happens is Trigger #1 fires, then Trigger #2. It appears that the Trigger actions fire in the order they were added rather than in the order of the current traits list.

This occurs no matter how many Trigger actions are added and what order they are placed in the current traits list.

I hope that’s clear enough. Please let me know if it needs more explaining.

Cheers

I suspect that the order they are created is how they fire. The order the
traits appear in the window is for how they affect other traits, the bottom
traits affect those above them. What you are describing is a simultaneous
activation, two triggers waiting for the same keystroke. The program being
procedural has to resolve them in some order though and the order they are
created seems as likely as anything. To get triggers to fire off in a
specific sequence regardless of their order of creation requires using
different hidden keystrokes with each trigger. Have one trigger on CTRL H
fire off a CTRL I, the next trigger looks for CTRL I (but leave the menu
text blank so it’s hidden) and fires off CTRL J, the next looks for CTRL J
etc.

Chuck

Post generated using Mail2Forum (mail2forum.com)

Hi,

You have this the wrong way about, the ‘standard logic of the trait list’ is exactly the opposite.

Imagine the trait list as a stack of cards - The first trait is the bottom of the stack, the second trait is placed above the first and so on until the last trait on the list is place on the top of the stack.

When a Key Command is executed, it is passed to the top card of the stack (i.e. the last trait first). It takes action, if necessary, and then passes the key on to the next card below it. In this way, later traits can affect those below (i.e. above it in the list). Any traits reacting to the same Key Command are peformed in the reverse order that they exist in the trait list.

B.

*********** REPLY SEPARATOR ***********

On 25/08/2009 at 7:52 AM LurchBrick wrote:


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

That’s exactly what does happen to any trait except the Trigger trait (from my observation).

Let me try another example. I add 3 Trigger traits labelled A, B and C to the trait list like so:

Trigger A
Trigger B
Trigger C

Each trigger fires on the command CTRL A. So when I press CTRL A during a game session, the triggers should fire in this sequence:

Trigger C fires
Trigger B fires
Trigger A fires

This is what I understand from your post. But this does not happen during the game session.

What does occur is the following fire sequence:

Trigger A fires
Trigger B fires
Trigger C fires

Which is the order I added them to the trait list, rather than the order that they should fire in.

It is as if the order of the trigger traits in the trait list have no effect on the firing order of the trigger commands. They will only fire in the order in which they were first added, even if you move them up or down in the trait list.

I have attached a test mod which shows the issue. I am currently using Vassal version 3.1.11 svn 6001. This problem also occurred in version 3.1.10. I don’t know if previous versions were affected as I never noticed this issue before.

I hope I’m not being a total dunce in not understanding or explaining the issue. :slight_smile:

Yes, I agree with you here, that is the order.

Nope, I took your test module and moved the triggers around and the order changed. I suspect what you did was change the order of the Report Action traits, not the triggers, which will not change the reporting order.

The order of execution of Triggers based on the same key command is in trait order, as you reported. It has nothing to do with the order you add them to the trait list.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Sorry, not trying to flog a dead horse here but why is that the correct order? I ask this because when you place different menu commands in the trait list, during a game, the menu items that appear when you right click the piece are in the reverse order of the trait list.

For example, in the Trait list in the Editor, we have these commands:

Delete Action - CTRL D
Clone Action - CTRL C
Invisible - CTRL I

Then when I right click on a piece during a game, this is the order the menu commands appear in the menu:

Invisible - CTRL I
Clone Action - CTRL C
Delete Action - CTRL D

I assumed (<- which is where I seem to be going wrong :unamused: ) this meant that any traits with the same key command get executed in order from the bottom of the trait list to the top. Hence why I would expect the triggers to fire in the order of C, B then A. This is what I thought you meant from your previous post when you described the traits as a stack.

P.S.

By the way, I believe I see where I may have been wrong with moving the Triggers around. When I changed the order of the Trigger traits in the editor and then tested those changes during a game, I was using the pieces I had already placed on the map. Whereas I should of been dragging new pieces from the Game palette as the new pieces would have the updated order in them.

I didn’t say it was the correct order, I was merely agreeing with you that my earlier email was incorrect and that the execution order proposed by you was correct.

I am open to being convinced that the current order is not correct. What problem is this causing you?

B.


Brent Easton
Analyst/Programmer
University of Western Sydney
Email: b.easton@exemail.com.au


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

The problem is mainly from a design viewpoint. One of the main problems that new module designers have is getting their head around the fact that traits at the bottom of the list affect traits above them and that traits fire in the order from the bottom of the list to the top.

Having Triggers act differently in the Trait list (with the same key combo) is counter intuitive and has led me to go around in circles a few times trying to sort it out. Having then to co-ordinate the Trigger traits and other traits in the same trait list can lead to confusion as I have to remember that Triggers fire in reverse order (with the same key combo) to other traits.

To sum up, I find it extremely handy to look at the trait list and see the order that traits will fire at a glance but when Triggers act differently, it can make the design process a bit more complex than it needs to be for this particular situation. I’m not sure how many module designers would have traits that fire off the same key combo so this may be a very minor issue.

Thanks for being patient and taking the time out to explain things to me.

P.S.

I have tested multiple traits with the same key combo, such as Move Fixed Distance, and I can’t find any other trait that exhibits this reversed behaviour.