Storyline makes working with variables easy. Using the Trigger Wizard, you can quickly set up your project variables without writing a line of code.
Variables are a way to remember information—such as a learner's name or numeric input—and then present dynamic content based on that information. They're also a great way to add conditional interactivity to your course.
Variables can only hold one piece of data at a time. A good example is to think of a slide that asks a learner for their first name. The variable can accept any text-based entry for the name, but it can only hold one learner's name at a time. Each time a learner enters a new name, the variable is updated with the most recent entry.
Types of Variables
In Storyline, there are three types of variables:
Text variables hold text-based values. Common examples include a learner's name, personalized feedback to a scenario and customized certificates at the end of the course.
Number variables hold numeric values. Common examples include a learner's score, number of attempts on a question and weighted quiz scores.
True/false variable are often referred to as boolean variables. Unlike text and numeric variables, they can have one of two states: on or off. Some common examples include custom Play and Pause buttons that toggle based on user input, a course aknowledgement button that, when clicked, enables the learner to complete the course.
- Create the variable
- Adjust the value of the variable
- Use the variable
Variables Vs. States
Variables are different from States. States can only hold information for the current slide, while variables can hold data across slides, scenes—even the entire project.
Use variables when you want to:
- Remember a learner's name
- Count the number of times a button was clicked
- Combine scores from one quiz with another
Use states and triggers to track:
- Which objects on a slide are clicked