Create account / Log in

Shared Trigger Action Loop Index Property

Talk about module design ideas and techniques.

Moderators: uckelman, Tim M

Shared Trigger Action Loop Index Property

Postby Martinov » April 16th, 2020, 8:10 pm

Wow, that was a frustrating *feature* to track down...

It seems that if you have multiple trigger actions [in the same prototype/piece] using the built in loop index property, you should be aware that the property belongs to the piece, not the trigger action.

Which means if you use the same index name in each trigger action, your subsequent ones won't fire, as the exit condition is reached on the first trigger action.
User avatar
Martinov
 
Posts: 53
Joined: March 30th, 2020, 10:58 am

Re: Shared Trigger Action Loop Index Property

Postby Cattlesquat » April 17th, 2020, 3:56 pm

Ouch, haha :D Yes the "scope" of a loop index is the whole piece, which is actually for the good reason that there are plenty of applications where you'd want to have access to the loop index in another trait (e.g. a "Send To Location" trait or something like that). But yeah, ouch!
User avatar
Cattlesquat
 
Posts: 987
Joined: December 2nd, 2019, 4:57 pm
Location: Baltimore, Maryland, USA

Re: Shared Trigger Action Loop Index Property

Postby barbanera » January 16th, 2021, 9:02 pm

It actually seems that bottom most trigger traits using a certain loop index property will block/confuse above trigger traits from using the same loop index property, even if they are not triggered at all.

Here is an example I banged my head against for hours:

basic piece
trigger 1, firing 3 times on command AAAA, using loop index Counter starting at 2 with increments of 2
trigger 2, firing 4 times on command BBBB, using loop index Counter starting at 0 with increment of 2

If one runs AAAA first it will assumes Counter=0 in each of the 3 iterations. I guess trigger 2 took control of Counter setting it a 0 and never relinquished it or something. Even if BBBB was not fired at all, I mean.
barbanera
 
Posts: 467
Joined: January 12th, 2012, 2:27 pm

Re: Shared Trigger Action Loop Index Property

Postby pawnpusher » January 25th, 2021, 5:26 pm

For the example:

basic piece
trigger 1, firing 3 times on command AAAA, using loop index Counter starting at 2 with increments of 2
trigger 2, firing 4 times on command BBBB, using loop index Counter starting at 0 with increment of 2

I'm guessing that if the loop index counters have different names, they won't interfere with each other as described, right?
User avatar
pawnpusher
 
Posts: 39
Joined: October 5th, 2013, 4:04 am
Location: Texas

Re: Shared Trigger Action Loop Index Property

Postby barbanera » January 25th, 2021, 8:45 pm

> I'm guessing that if the loop index counters have different names, they won't interfere with each other as described, right?

Right.
barbanera
 
Posts: 467
Joined: January 12th, 2012, 2:27 pm


Return to Module Design

Who is online

Users browsing this forum: No registered users and 6 guests