Storyline 360: Random Number Variables
Article Last Updated
This article applies to:
Make Storyline 360 interactions more gamelike and unpredictable with random number variables. They let you easily build math problems, present learners with randomly selected content, and add gaming elements to your courses.
- How to Create a Number Variable with a Random Default Value
- How to Assign a Random Value to a Number Variable Using a Trigger
How to Create a Number Variable with a Random Default Value
Here’s how to create a number variable that has a different default value each time your course is launched.
- Click the Manage project variables button in the triggers panel.
- When the variables window opens, click the plus sign in the lower left corner to create a new variable.
- Give your variable a Name. Use letters and numbers only, no spaces or special characters.
- Select Number from the Type drop-down list.
- Select Random from the Default value drop-down list.
- Define the range of acceptable numbers by entering the starting and ending values in the spinners that appear.
- Click OK twice to save your new variable and close the variables window.
Each time your published course is launched, Storyline will select a random whole number from the range you defined and assign it to your variable. Then you can trigger actions based on that variable. For example, you might send learners to different decision-making scenarios.
Your starting and ending values are included in the range of potential numbers. For example, if you define a range of 1 to 10, Storyline could randomly select 1 or 10 or any whole number in between.
The widest acceptable range is 0 to 2,147,483,647.
Random number variables accept whole numbers only. Decimals aren’t supported. To generate random decimals, use a high range of values—perhaps 100 to 1,000—then divide the number variable by 10, 100, etc.
Learn more about working with variables in Storyline 360.
How to Assign a Random Value to a Number Variable Using a Trigger
Here’s how to use a trigger to give any number variable a random value at any point during your course.
- Click the Create a new trigger button in the triggers panel.
- When the trigger wizard opens, set the following properties:
- Action:
Adjust variable
- Variable: Select a number variable from the drop-down list.
- Operator:
= Set
- Value: Select
Random number
from the drop-down list and enter starting and ending values. - When: Select an event that initiates this trigger, such as when the user clicks a button.
- Object: Select the object that’s part of the event that triggers this action. For example, this might be a button that the user clicks.
- Action:
- Click OK to save your new trigger.
Each time your trigger fires, Storyline will select a random whole number from the range you defined and assign it to your variable. Then you can trigger actions based on that variable. For example, you might add gaming elements to your course, such as allowing learners to roll dice or calculating how many spaces they move on a gameboard.
Your starting and ending values are included in the range of potential numbers. For example, if you define a range of 1 to 10, Storyline could randomly select 1 or 10 or any whole number in between.
The widest acceptable range is 0 to 2,147,483,647.
Random number variables accept whole numbers only. Decimals aren’t supported. To generate random decimals, use a high range of values—perhaps 100 to 1,000—then divide the number variable by 10, 100, etc.