Anyone who’s played around with Storyline variables knows how powerful they are. One of the variable types available to you is the number variable. You can use number variables to calculate all kinds of mathematical equations, from a simple addition and subtraction, to complex multiplications and divisions.
Why are number variables useful in e-learning? One reason is that they’re a great way to calculate points for a score across multiple slides. You can also use number variables to simulate a real-life calculation learners need to do on the job.
If you’re new to using number variables, you should start with something basic, such as a simple addition. In today’s article you'll learn how you can build just that in a few easy steps. Let’s have a look at how to build the following basic addition interaction:
Create the layers
The first thing you want to do is create your slide, which will have 2 layers. First, create a base layer and drop in 2 text entry fields. In my example, I styled the text entry fields to be transparent and have the chalkboard-style font. You also want to add a button on this base layer. This button is what triggers the equation to happen.
The next thing you’ll want to do is create a slide layer. This slide layer reveals the total of the calculation and a button which resets the equation. Make sure you check off the slider layer option that prevents the user from clicking on the base layer.
Create the variables
For this interaction you will create 3 number variables. In my example, I named the variables Add1, Add2, and AddTotal. You will assign the Add1 variable to the first text entry field, the Add2 variable to the second text entry field, and on the slide layer, create a reference that displays the AddTotal variable.
Create the triggers
The last thing you need to do is create the triggers that control the behaviour of the interaction. On the base layer, add 3 triggers to the “View Total” button. The first trigger adds the value of the Add1 variable to the AddTotal variable, a second trigger adds the value of the Add2 variable to the AddTotal variable, and a third trigger shows the slide layer.
On the slider layer, you also need to add triggers to your “Reset” button. You want to add 4 triggers in total. 3 triggers that reset each of the 3 variables to 0, and one that hides the slide layer, to bring you back to the base layer where you can continue adding different numbers over and over again, as long as you please!
Ta-da! That’s how easy it is to build this simple addition using Storyline’s number variables. Do you have any comments or questions? Leave them below! Don’t forget to follow us on Twitter for all the latest news related to Articulate software and e-learning!
Want to try something you learned here, but don't have Articulate software? Download a free trial, and come back to E-Learning Heroes regularly for more helpful advice on everything related to e-learning.