Variables across scenes
Nov 12, 2013
By
Todd Brison
Hi all!
First off, as semi-competent developer, I love all the functionality Storyline offers.
My problem seems to be carrying variables over across scenes.
I have a module where people can collect badges, and obviously I'd display them as normal if they've found them (e.g. the badgefound variable has been set to true)
But in later scenes, the badges are acting like the have not been found. Upon writing this it occurred to me I should display the variable on-screen to see if I can figure out if it's actually being changed.
For now I'll just leave this here in case someone else has already conquered a similar problem.
5 Replies
Hey just letting everyone know I figured it out!
Turns out it was a simple fix. I was changing the state of my badges based on the state of the picture itself, not the slide.
Hi Todd and welcome to E-Learning Heroes! Glad that you were able to get this sorted and thanks for the update
Hi Todd, can you explain me how can you keep the new value of a variable through scenes.
When I change scene my variables kind of reset to cero, without having any JS code that reset them.
Thanks
Hi Paul,
Whenever a variable is set or adjusted, the current value is available throughout the entire course, whichever scene you switch to. Unless you are doing something with triggers to reset it, there should be no reason why it changes to zero.
In the attached example, I have created three separate scenes and a variable called Counter. In each scene you can increment the variable by 5 each time you click on a button and can then jump to the next scene. You will see that the variable maintains the same value in the next scene and any additional increments you add will then show in any subsequent scene.
Hi Ned, I apreciate your answer a lot.
I´m gonna take a look at your file and try to enrich it.
I thinks is good for all to publish what we know and make available to everyone cause there is small development for JS at storyline.
Regards!
This discussion is closed. You can start a new discussion or contact Articulate Support.