There’s one moment in particular that brings me extra delight as an instructor during our Storyline workshops. It’s that look of awe from participants when we draw attention to a trigger that works because of the sequential order of the triggers themselves.
As you may know, triggers execute all of the action in our Storyline builds. Aside from a few timeline-based events, we see most of our slide actions listed in the Triggers Panel. However, the sequential order of triggers within the panel can also be significant. You may or may not be aware of this, because trigger order matters in some builds but not in others. This begs the question, “When?”
A great example of trigger order mattering is in performing numeric calculations. The order could affect the entire functionality of a design. Since the sky is the limit with Storyline, we will narrow our focus to one very specific case: calculating an average.
Let’s assume our Storyline course will help kayakers calculate their average kayaking speed. To do so, we would need to provide an area for our users to type in their own numeric entries. Articulate provides numeric Data-Entry fields for this exact purpose.
We have drawn two numeric data-entry fields onto our slide. Our kayaker will enter their speed traveling up the river into the first field provided. Then, they will do the same for their speed traveling back again in the second field.
Data-entry boxes—be they text or numeric—always create their own variables. Variables are Storyline’s way of remembering data globally throughout the course, regardless of where the user may be.
We have named the corresponding variables for both data-entry fields (to TravelingUp and TravelingBack) in our variables window, accessed in the Manage Project Variables button in the Triggers Panel.
Tip: Consistent naming of objects and variables is an important best practice to make your job as a developer easier!
By default, Storyline automatically sets each variable to the value entered when the user leaves the data-entry field, or, as you can see in the trigger terms, “when the control loses focus.”
Now, to actually determine the average speed and display it, we need to build calculation triggers and then create a custom layer called “Calculation” to show the result.
While there are varying ways to accomplish this numeric calculation in Storyline, we have chosen to create a third numeric variable titled Average that will serve as our result. The calculation triggers required are the same process we would use to figure an average of two values with pencil and paper: add the two values together, then divide by two.
As we know, Storyline performs triggers for a single object in succession. In our case, that’s when the user clicks the “Go” button.
The triggers under “Go” are in the order in which we want Storyline to do our math. That is: add first, divide second. As you can see, there are four triggers that make everything happen:
- The first trigger adds the first speed to our Average variable.
- Our second trigger adds the second speed to our Average variable.
- The third trigger divides the new value of the Average variable by two.
- The fourth trigger shows a layer that displays our results.
On the “Calculation” layer, we simply reference our variables by typing them in the text box with a percentage sign on either side of the variables’ name (does not have to be case-sensitive, though it is a best practice to remain consistent) OR by selecting the Reference button on the Insert tab. If you’d like to take a more in-depth look at this course under the hood, download our sample file here.
For demonstration purposes, we’ll say that our kayaker traveled up the river at 20 miles per hour and back to the docks at 10 miles per hour, entering these values onto the slide. (Feel free to try it out yourself here.)
We are adding 20 to 10, dividing that sum (30) by 2, then showing the Calculations layer. With those speeds, the kayaker’s average should display in our layer as 15 mph.
Why Trigger Order Matters Here
The key here is to make sure that both addition triggers precede division trigger. For example, if we incorrectly divided before we added the second variable of TravelingBack, our average would have come out to 20 mph (20/2= 10; 10+10=20) instead of the correct answer of 15 mph (20+10=30; 30/2=15).
Should you ever accidentally add triggers in the wrong order and need to correct the trigger order, select the trigger you’d like to move and adjust it with the up and down arrows in the Triggers Panel. Voilà!
In addition to triggers that calculate data, there are quite a few other instances when trigger order matters. For example, Master Slide triggers will occur prior to normal slide triggers. Trigger order may also be useful in troubleshooting an issue. Every course is unique, so analyze what you have going on in your Triggers Panel to determine whether the order matters.
Please feel free to ask questions or leave comments about your experiences with trigger order below. Remember, when adding more movement, interactivity, and life to your designs—get trigger happy!
“What’s your story?”