We explore all the variables of variables during our hands-on Storyline 360 training, and in doing so, we so often stumble upon e-Learning interactions that would benefit from a variable reset. Join us today as we answer this “as heard in training” question: “Can I Reset a Variable?”
In Storyline 360 e-Learning development, there are many motivations to reset a variable, otherwise known as “initializing.” (And luckily, initializing a variable is easier than you might think—often requiring just one additional trigger.)
Not only can initializing variables become necessary when developing interactions with calculations but resetting variables is also a best practice of ours, for example, when working with sliders and dials!
Why would I reset a variable?
You may notice that slider interactions in your e-Learning don’t automatically reset to their original position upon revisiting a slide. However, for our example, we want to make sure our slider does reset.
The slider thumb automatically remains wherever the learner last left it, even if the slide resets based on Slide Properties. This is the case with dials too, and this behavior is due to sliders and dials relying on their variables to function.
By default, variables always “remember” their most recent value—which is a phenomenal feature and is the main reason we utilize variables all the time at Yukon Learning!
Since variables have such a great memory, we need to force our slider’s variable to “forget.” It’s time to initialize or reset the variable.
How do I reset a variable?
We’ll create just one trigger to ensure that our slider thumb always resets to its starting position.
Triggers should answer two questions: what do you want to do, and when do you want to do it?
Since sliders function based on their variable, we want to adjust the slider variable to its initial value whenever the timeline starts on this slide. This effectively resets the variable and the slider position upon every revisit.
In our example, the slider’s initial value is 0, so we’ll reset the value to 0 when the timeline starts.
Tip: You may already know this about us, but at Yukon Learning, we’re profoundly serious about our naming conventions, so we named our slider’s variable in the variable manager window to recognize it easily. If you download our example file, you’ll notice we named our variable “RunningSlider.”
OK, let’s create our new trigger. It should read as:
Adjust variable
Set (name of your slider variable) to value 0
When the timeline starts on this slide
We’ve made it a best practice of ours to add this trigger to the slider and dial interactions that we develop at Yukon Learning. You may find it beneficial to add this trigger to your processes too.
It’s nice when a solution is as simple as adding just one additional trigger to your build. Hopefully, this solves something you’ve wondered about, demystified what may have seemed difficult to do, or gave you just what you needed right before building your first variable-based interaction.
Have you come up with a creative way to initialize or reset a variable? Did this post bring up other ideas? We’d love to hear from you in the comments below, and until next time, happy developing!
Got sliders on your mind now? Check out some of our other slider-related blog posts below:
- Can I Use a Slider to Page Through a Document?
- What If I Need the Stops in My Slider to Be Uneven?
- How Can I Make a Slider More Engaging?
- How Can I Use a Slider as a Progress Meter?
- Can I Change the Thumb on the Slider When It Moves Along the Track?
- How Can I Use a Slider to Create a Moving Timeline?
~ John M.
Leave a Reply