Forum Discussion
Order of Triggers using Javascript
Ramon -
Triggers will begin execution in order. However, because JavaScript is executed synchronously (even though your triggers are executed sequentially) your second trigger may eval a value that the first trigger hasn't yet set. A few ways around this, here's how I'd do it:
Javascript trigger:
//execute all of your stuff.
//Set SMART to true or not
//Increment a storyline variable
var player=GetPlayer();
var remoteTrigger=player.GetVar("rtrigger");
if(SMART){
remoteTrigger++;
player.SetVar("rtrigger",remoteTrigger);
//you could also do this with a true / false variable... possibly using your SMART variable to trigger the jump.
}
In Storyline:
Setup a When variable changes event to jump to the next slide. This creates a listener that will trigger your action whenever the variable changes. As mentioned in the comment above, you could use your SMART variable to trigger the advance (When Variable Changes SMART, jump to next slide if the value == true).
The remote trigger and listener method is handy for lots of things including communication between the master slide and the base slide.
- JillFreeman-64d5 years agoCommunity Member
Hi Steve. I am a JS novice. When I add multiple js in the Execute javascript trigger, do you mean they all fire consecutively? Or do they execute in order from top-down?
Related Content
- 5 months ago