One thing that I have learned is that if you are using Storyline and want to build eLearning games or interactions, you need to use variables and conditions within Storyline. But most developers starting out with Storyline don’t even know what a variable or a condition is.

What is a variable?

Simply asking, “What exactly is a variable?” will point out things you probably have forgotten.

For me, asking this question led to doing a little Google search. Since I wanted to narrow my definition of variables to just programming, I tailored the question to read, “What is a variable within programming?”

I quickly found a wiki article with a definition that offers tremendous insight. The article says, “In computer programming, a variable is a storage location and an associated symbolic name.” In other words, a variable stores information that we can access and change at any point in a game or a course. We give each variable a name.

This fits perfectly for working with variables in Storyline games. For instance, we will have information that we need to keep track of in a game, whether it is a name, a score, or even just a true/false setting. We might also need to store data to test against (to add to or take away from) at a later point, such as a variable Storyline can check to make sure the learner visits or does certain things before Storyline allows him or her to continue.

Three types of variables in Storyline

With the understanding of what a variable is, what types of variables can we use? There are three variable types in Storyline: true/false, numbers, and text. I will explain the benefits of each later but first let me show you how to get to your variables.

To access your Storyline variables, click on the “X” icon in the triggers section. It is on the far right side of the screen on the same bar where you add and move triggers. If you hover over it you will see it says “variables” (Figure 1).

Storyline Variables
Figure 1:
Click the “X” icon to get to your variables

When you click on this button you will see all the variables for the current project that you are in (Figure 2). If this is the first time you have ever seen this screen then you should probably just keep it blank. If you have variables, this is where you can see the variables for your entire project.

Storyline VariablesFigure 2: This is the screen where you will see the variables for your current project

You can add new variables by clicking on the page icon on the bottom left that looks like a page with the top right corner folded over (Figure 3).

Storyline VariablesFigure 3: To add a variable, click the “dog-eared page” icon in the lower left of this screen

What I really love about Storyline is that it makes working with variables a whole lot easier than trying to memorize all the code as you must do with ActionScript or JavaScript. Storyline just presents you with simple drop-down boxes. You see in Figure 3 a place in the variable dialog box to give this variable a name, which is the “symbolic name” the wiki definition was talking about. There can be no spaces within this name, and I recommend you name it something you will remember when you are programming your game. Then you choose what type of variable you want it to be (Figure 4).

Storyline VariablesFigure 4: Name the variable and select the variable type at the same time

As I mentioned before, Storyline has three different types of variables to choose from. You can use true/false, numbers, or text. Select the type you want, and then enter the default value of the variable. This is how you initially store a value for the variable. For instance, if you are keeping a score the default value will probably be 0 because that is what your learners start out with when they first come to the game. If you want to store the learner’s name then you probably could just leave it blank: you do not know what the learner’s name will be so there is nothing to store yet. Just set the variable up by name and type, and leave the value blank.

What is the difference between these variable types? Let’s explore that now.

True/false variables

The true/false variable can be either (you guessed it) true or false. I like to think of this as off or on, or a visited or not-visited variable. It is useful for “on/off” settings. If you want to give the learner the ability to play audio, when the variable is set to false the audio won’t play. You still have to add the condition to the trigger but first you have to set the variable. It can also be used for visited or answered questions. If you have the variable default set to false, then when the learner clicks on an item you change the variable to true and then the learner can continue. And of course, the variable has to be created before you can use it in your triggers and conditions.

Number variables

The number variable will just store a number. No text whatsoever. So I find this most useful if you want to keep track of how many times someone attempts an interaction, or what his or her score is in a game. We use this in all of our Storyline games as you can see in our examples. In our game show we have a score, and whenever the learner answers a question Storyline will add the points for the chosen category to the score variable.

Text variables

Text will store any string of text: names, phrases, or anything else. I find this useful if you want to personalize your games or courses. You can have a text-entry field where the learners will type in their names. Then you can display the learner’s name by typing within % signs the name of the variable. So if I create a variable called ”name” and at some point I want to display the learner’s name on the screen, all I do on my page text is enter “Hello %name%, welcome to the course” in the course script. When the learner comes to that page, he will see, “Hello Jeff, welcome to the course.” When you use a name it grabs the learner’s attention.

If you have a word or a phrase that may change, place it in a variable. For example, years ago I worked in a call center where, for trouble shooting, we used a database named “Doris.” Well, what if the name of the database was changed to “Eunice.” If someone at that call center had created a trouble-shooting course with the name “Doris” plastered on every page, it would be a huge pain to go in and change the name to “Eunice” in all those places. You could create a text variable with “Doris” as its default value. You could even call the variable “Doris.” In that case, when the instructional designer created the course, he or she would just wrap “Doris” within percentage signs: %Doris%. Then Storyline would find everything it needed in %Doris%. If I need to change the name later, I just go back into the variables and change the default value to something else and Storyline will automatically update every page with the new name.

With your variables created, you can use triggers and conditions to make your content awesome!