Authors
Video Tutorials
Storyline 3: Working with Variables
Use variables to remember information—such as a learner's name or a numeric value—then display dynamic content based on that information (see Working with Variable References).
Variables are also a great way to add conditional interactivity to courses (see Working with Triggers). And the good news is you don't have to know anything about coding!
- Adding Variables
- Using Triggers to Adjust Variable Values
- Evaluating Variables in Trigger Conditions
- Referencing Variable Values in Slide Text
- Editing Variables
- Deleting Variables
- Finding Variables
- Translating Variables
- Understanding the Difference Between Variables and States
Adding Variables
- Click the Manage project variables icon in the Triggers panel.
- When the Variables window opens, click the Create a new variable icon (looks like a plus sign) in the lower left corner.
- Give your variable a recognizable name so it's easy to identify later.
- Choose the Type of variable you want to create. Storyline supports three types:
- True/False: True/False variables are often called Boolean variables. They're either true or false. They're great for creating toggle buttons and restricting learners' options. For example, you might use a true/false variable to track whether a certain event has occurred, then let learners proceed to the next slide only when the variable is true.
- Text: Text variables hold text values. Common uses include personalizing content by displaying the learner's name throughout a course and evaluating text-based interactions. Text variables can hold up to 32,767 characters.
- Number: Number variables hold numeric values. Common uses for number variables include tracking the number of times a particular event has occurred and performing mathematical calculations.
- Enter a default Value. (The default value for text variables can be blank.)
- Click OK to save your new variable.
- Click OK again to close the Variables window.
Storyline automatically creates variables for you in the following cases:
When you create a... |
These variables will be created for you... |
Four number variables will be added for scoring purposes. |
|
A number variable will be added to track the dial value. |
|
A number variable will be added to track the slider value. |
|
A text variable will be added to track learners' input. |
|
A number variable will be added to track learners' input. |
Using Triggers to Adjust Variable Values
Need to change the value of a variable during a course? Easy. Just add an Adjust variable trigger.
See this user guide to learn more about triggers.
Evaluating Variables in Trigger Conditions
You can use variables to add conditions to triggers. See this user guide for details.
For example, let's say you want to change the state of an object when a true/false variable is true. It'd look something like this:
Referencing Variable Values in Slide Text
Variables store data. Triggers let you adjust the data. And variable references let you display the data anywhere in your course, making your content dynamic and interactive.
For example, you might ask learners to enter their names on the first slide in your course. You store that information in a variable. Then you use variable references to personalize the rest of the course with their names.
In another example, you might ask learners to enter their weight and height. You store both values in variables. You use triggers to calculate their body mass index based on those variables. Then you use variable references to display the results.
Variable references can be added to any text-based object, including text boxes, captions, shapes, and buttons. See this user guide to learn more about variable references.
Editing Variables
- Click the Manage project variables icon in the Triggers panel.
- Select the variable you want to edit and click the Edit icon (looks like pencil) in the lower left corner.
- Rename the variable and/or change its default value. (You can't change its type.)
- Click OK twice to save your changes and close the Variables window.
Tips for editing variables:
- You can also rename variables and change their default values just by clicking in the grid.
- When you rename variables, all references to those variables in your slide text and triggers will be updated automatically.
Deleting Variables
- Click the Manage project variables icon in the Triggers panel.
- Select the variable you want to delete and click the Delete icon (looks like a garbage bin) in the lower left corner. (You can also press the Delete key on your keyboard.)
Tip for deleting variables:
- When you delete a variable, all references to that variable in your slide text will remain intact. You'll need to edit or delete those references manually.
- Triggers that involve deleted variables will also remain intact, but they'll become "unassigned." You can either edit or delete those triggers.
Finding Variables
If you use variables extensively, it can be difficult to remember where they're referenced throughout your course. No problem. You can generate a variable usage report.
- Click the Manage project variables icon in the Triggers panel.
- Click the hyperlinked number in the Use Count column for the variable you want to find.
Storyline will display all references to that variable in a separate window.
Translating Variables
Storyline has built-in translation features to help you localize content in different languages.
However, it's important to note that the translation features let you translate default values for variables and references to variables in your slide text, but not the names of those variables.
If you translate variable references in your slide text, you'll also need to manually translate the variable names in your project (see Editing Variables). If variable names and references don’t match, variable references in your slide text won't work.
Understanding the Difference Between Variables and States
Variables and states both track information and add interactivity, but they differ in scope and behavior.
States control visual elements for a single slide, while variables control elements across slides, scenes, or an entire project.
Here are some examples of when to use variables and when to use states.
Use variables when you want to: |
Use states when you want to: |
|
|