Long term time delay

Jul 30, 2019


We want to create a course that you go through a few screens and then exit and apply in real life. Then a set amount of time passes (e.g. 3 months), you can come back to the same module, resume, and put in updates to receive credit. 

The longest time delay is 1000 seconds and I don't know if time is counted when you are not actively in a course. Is this idea even possible in Storyline? 

1 Reply
David Schwartz

Hi Stacy,

You could do something like this with some Javascript, but it's not perfect, because people would have to be instructed to be sure to resume the course when they return, in order that the values of the variables are maintained.

I'm attaching an example. (I'm no expert on this stuff, but it is working.) On the first slide is a Javascript trigger that gets today's date, and calculates the intended resume date, which I set to 90 days.

Then on the next screen, which is where the user would be told to exit if the date is not yet the return date, is a little bit more Javascript. There, it calculates today's date. Then on that screen are some triggers to compare today's date to the return date. You'll see there is a variable that is subtracted from today's date first. That is because the numeric value of a date in Javascript is calculated in milliseconds, and I wanted to set it so that if a learner returns on the exact return date, but earlier in the day than they started originally, they could still proceed. So basically, 90 days becomes 89 days to be safe. (There are probably cleaner ways to do this, but as I said, I am far from an expert in Javascript.)

Finally on that screen are triggers to turn on and off the appropriate text boxes and the Next button.

Review link: https://360.articulate.com/review/content/e2950782-b637-479e-a08a-8bb3234fc74c/review


For reference, here's the first Javascript trigger:

var player = GetPlayer();

var today = new Date();

var newdate = new Date();
newdate.setDate(newdate.getDate() + 90); //Put the number of days of delay here. Currently set to 90
var newdate_numeric = Date.parse(newdate);

var dd = String(today.getDate()).padStart(2, '0');
var mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!
var yyyy = today.getFullYear();

today = mm + '/' + dd + '/' + yyyy;

var new_dd = String(newdate.getDate()).padStart(2, '0');
var new_mm = String(newdate.getMonth() + 1).padStart(2, '0'); //January is 0!
var new_yyyy = newdate.getFullYear();

newdate = new_mm + '/' + new_dd + '/' + new_yyyy;

player.SetVar("initial_date", today);

player.SetVar("return_date", newdate);

player.SetVar("return_numeric", newdate_numeric);

This discussion is closed. You can start a new discussion or contact Articulate Support.