I have read the online comments but I cant find exactly what I'm looking for -I want to count down the day to Pie/Pi Day in an elearning. I think this is possible using variables (I dont want to use HTML code or javascript). When Pi/Pie day arrives ( March 14 ), I want the timer to start counting again for the next year. Is there a way to do this using the variable feature? Thanks, Beth
Hi there, Beth! You won't be able to track the current date in a Storyline course unless you're pulling in information from where the course is being hosted (or from where the learner is, to account for time zone differences). You would need JavaScript to inject your course with that extra functionality.
Community experts: has anyone found a way to do something similar?
In the meantime, Beth, could you place a web object in your course to bring in an external countdown from the internet?
Beyond the option Crystal had mentioned, Javascript is the only other way to create a counter. Here is an old script (it was used to count down to June 12, 2014) you could adapt:
var minutes=1000*60; var hours=minutes*60; var days=hours*24; var todaysDate = new Date(); var todaysCounter=todaysDate.getTime(); var todaysDay=Math.round(todaysCounter/days); var beginCounter = Date.parse("June 12, 2014"); var BeginDay=Math.round(beginCounter/days);
var DaysLeftJS=BeginDay - todaysDay +1
var player = GetPlayer(); player.SetVar("DaysLeft",DaysLeftJS);
Can you point me in the direction of finding a good explanation of where and how to put in javascript in storyline? I've looked around, but I have seen a step-by-step explanation. I'm new to using custom code so if you can recall a good starter tutorial or explanation I would be grateful!
While Javascript isn't my expertise, I can pass along a couple helpful tips. Javascript can be added to "Execute Javascript" triggers. Check out these Javascript Best Practices, and give it a go!
Hopefully other Java-savvy folks in the community can chime in here, as well.
4 Replies
Hi there, Beth! You won't be able to track the current date in a Storyline course unless you're pulling in information from where the course is being hosted (or from where the learner is, to account for time zone differences). You would need JavaScript to inject your course with that extra functionality.
Community experts: has anyone found a way to do something similar?
In the meantime, Beth, could you place a web object in your course to bring in an external countdown from the internet?
Beyond the option Crystal had mentioned, Javascript is the only other way to create a counter. Here is an old script (it was used to count down to June 12, 2014) you could adapt:
var minutes=1000*60;
var hours=minutes*60;
var days=hours*24;
var todaysDate = new Date();
var todaysCounter=todaysDate.getTime();
var todaysDay=Math.round(todaysCounter/days);
var beginCounter = Date.parse("June 12, 2014");
var BeginDay=Math.round(beginCounter/days);
var DaysLeftJS=BeginDay - todaysDay +1
var player = GetPlayer();
player.SetVar("DaysLeft",DaysLeftJS);
Thanks!
Can you point me in the direction of finding a good explanation of where and how to put in javascript in storyline? I've looked around, but I have seen a step-by-step explanation. I'm new to using custom code so if you can recall a good starter tutorial or explanation I would be grateful!
Hi Beth!
While Javascript isn't my expertise, I can pass along a couple helpful tips. Javascript can be added to "Execute Javascript" triggers. Check out these Javascript Best Practices, and give it a go!
Hopefully other Java-savvy folks in the community can chime in here, as well.
This discussion is closed. You can start a new discussion or contact Articulate Support.