Trigger order is misbehaving

I am creating a drag and drop activity to create a square shape. I have 6 triggers to check whether there is a square shape then show the correct layer. Finally in last i have created a trigger to show the incorrect layer if all previous triggers condition do not match and they do not get activate. but storyline always activate the last trigger in all case even the condition  of any previous trigger is true. I have to fix it by today. Please help.

5 Replies
Crystal Horn

Thanks for including your .story file, Shubhendu!  Because your trigger list is really built out, can you help me narrow my focus?

Can the user make a square in any area of the star box?

It looks like the "v's" and "h's" are possible lines in square configurations, and you're using sets of them to make squares.  For example:  v1, v2, h1 and h3 all make a square.  So those variables (and only those variables) have to be true.

Let me know if I'm on the right path!  I couldn't get the correct layer to show after making a square.  

Shubhendu Shankar Das

Hi Crystal Horn,

Thanks for replying. Yes, the user can make a square in any area of the star box. Hence, the maximum possibility of boxes is 6. And for each possible box, we have a trigger to check and then show the correct layer, which just has a smiley face for testing. Other than the 6 possibilities, in any other possibility, the incorrect layer needs to be displayed, which just has a cross symbol for testing. 

The correct layer will be displayed once you create a square and then click on the Done button.

Thanks in advance.

Walt Hamilton

There is no "Else" in SL triggers or conditions. The system will go through your list of triggers, and if the conditions for any of them is met, will show the correct layer. Then at the end it will always show the incorrect layer:


So even if you get the problem correct, the correct layer is hidden by the incorrect layer, as Crystal found.

The only way around it is to write in the conditions under which you want (or do not want) the incorrect layer to show. I can imagine that would be an impossibly huge list. Probably it would also involve some combinations of AND and OR, which SL does not allow.

What I would do is to set a variable at the beginning, and have the correct layer change it when it opens. Then set that last trigger to open the incorrect layer if the variable has its original value.

On second thought, you might get away with moving the trigger to show the incorrect layer (just as it is) to the top of the list. It would always show, unless the system , in going through the list of triggers found a correct answer. Then it would show the correct layer, hiding the incorrect layer. I wouldn't advise that, because you might get lucky and hide the incorrect layer fast enough that the learner wouldn't see it, (It sounds like that's what happened to Crystal.) but you might not, and there would be a flash of the incorrect layer.

Shubhendu Shankar Das

Hi Walt,

Thanks for replying. Your first trick of adjusting the variable on correct layer worked and it is nice. but the second thought still not working. I have also used other ways to implement the same concept and attaching the file that how I did that.

But my confusion, about the order in which triggers are executed in SL if there are multiple triggers on the same object, still remain. What I know that if there are multiple triggers on the same object they are executed in the same order as they appear in the list and that is why the order of trigger matter a lot at many times. Also if there is a trigger in the list that lets you jump to another slide or any other layer all other triggers, after that trigger, do not execute. This has happened to me many times that I had to change the order of trigger to get many issues fixed. These issues were arising because few trigger were not executing just because before executing those triggers, any previous trigger let the slide jump to another layer. Could please help me understand this?

Thanks in advance.



Walt Hamilton

It is exactly as you say.

When an action occurs the administrative part of the program reads the list of triggers that are activated by that action. It starts at the top, and proceeds through them in the order they are listed. it reads the first one, and assigns it to the appropriate servant routine to execute. while that one is executing, it reads the next one, etc. It is so fast, that they can all seem to occur simultaneously, but in reality, the ones that take less time to execute probably finish an itty bit sooner. That can cause timing problems, which is why if you have a large number of complex triggers attached to the same action, you can sometimes get results you don't predict.

If in the middle of a list, it encounters a jump to slide command, it jumps, and loses the list of triggers (it is replaced by the trigger list at the new location.) No triggers found after a jump are ever executed.

If it encounters a trigger to show a layer, the list of triggers continues to be executed, because the layer is part of the same slide' thus the trigger list is not interrupted.