Anyone Create a Countdown to a day using variables? Help!

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

4 Replies
Crystal Horn

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?

Michael Hinze

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);

 

beth grella

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!