How do you reset global variables in Storyline 360?
Feb 04, 2022
By
Roger Kerr
Hey there
How do you reset global variables in Storyline 360?
I am using JavaScript in a Storyline project where I have object triggers set to a variable which then executes JavaScript, and then sets a variable to be equal to the typed value. This is for a Point of Sale (Till) operation that I am simulating. Users will input the number of notes/coins which are then given a dollar value.
The JavaScript works for the first scene, but when the user moves on to the next scene where a similar function is required, the quantities are 'copied' across from the previous scene. Is there a way to reset them to zero for the new scene?
Cheers
Roger
How do you reset global variables in Storyline 360?
I am using JavaScript in a Storyline project where I have object triggers set to a variable which then executes JavaScript, and then sets a variable to be equal to the typed value. This is for a Point of Sale (Till) operation that I am simulating. Users will input the number of notes/coins which are then given a dollar value.
The JavaScript works for the first scene, but when the user moves on to the next scene where a similar function is required, the quantities are 'copied' across from the previous scene. Is there a way to reset them to zero for the new scene?
Cheers
Roger
3 Replies
Hi, Roger.
Thank you for reaching out!
While I'll leave the Javascript to more knowledgeable community members, the other option would be to use triggers to reset the variables when the timeline starts on the second slide:
Set 100_Entry to value 0 when the timeline starts on this slide
I hope this helps!
Hi Maria
Thank you for responding :-) Yes, leave it to the javaScript gurus! However, using triggers should work but it will be a lot of work perhaps?
Hi, sorry I'm late to the party. This works very well, thanks. Is it designed for re-attempts? As it doesn't reset. I can reset the variable but not the progress bar also it jumps to 100 on second click on re-try.
Many thanks.