Time & Date Variables in Storyline
Aug 22, 2013
By
Ian Mondrow
Hi All,
I saw the posting to help the discussion regarding insert the current date into the course using a javascript. However, it puts the date in MM/DD/YYYY format. How would you go about putting the date into a format like,"Thursday, August 22"?
Also, how would you write a javascript to show the current time? I don't need a timer, but an actual clock. I found a few javascripts online (http://www.quackit.com/javascript/tutorial/javascript_date_and_time.cfm) but they didn't work. I think its because they are not articulate specific.
I am completely new to java so I have no idea how to write them from scratch. Any help is appreciated!!!
57 Replies
Hi Ian! I'm hoping you get some community responses on your request as Articulate does not support JavaScript.
I did, however, want to share another thread with you about the 'clock' feature you mentioned as this just recently came up.
That's an interesting post but I need it in that specific format because I am trying to recreate an iPhone-like simulator in my course.
Well Ian, I hope someone would be able to assist you. Now that you mention what you are trying to achieve, there is another thread here that might assist
Hi Ian, I'm not a JavaScript expert either, so I just used a simple JavaScript like this:
var JSdate = new Date();
var JSSeconds = JSdate.getSeconds();
var JSMinutes = JSdate.getMinutes();
var JSHours = JSdate.getHours();
var JSDOM = JSdate.getDate();
var JSMonth = JSdate.getMonth();
var JSDay = JSdate.getDay();
var player = GetPlayer();
player.SetVar("Minutes",JSMinutes);
player.SetVar("Hours",JSHours);
player.SetVar("DOM",JSDOM);
player.SetVar("Month",JSMonth);
player.SetVar("Day",JSDay);
to get the 'raw' date and time values into Storyline variables. Then, I do the 'conversation' with triggers in Storyline. For example, I convert a JavaScript day value of 5 to 'Friday', etc.
Here is a sample of the end result.
So from the post above it (net/net) a date cannot be used in the storyline presentation? Any Storyline folks out there that can help would be greatly appreciate any input from a storyline person?
Just came across this post and was wondering how you got the time to update. I can get the time to show but it never updates as yours does.
Updated version to show just the day of the week, month, day of month, year.
//grab current full date
var JSdate = new Date();
//convert to readable format
var JSFullDate = JSdate.toDateString();
// Get player info
var player = GetPlayer();
// set the Date variable to the readable format
player.SetVar("Date",JSFullDate);
Then you can call the variables in a textbox. For example
%systemdateDayOfWeek%
Thanks for popping in to assist Nuno :)
Pretty Cool Nuno! Thanks!
This is how the time and date looks like using the method described. The image its in Portuguese language, sorry.
I´m glad i could help.
Thanks for sharing Nuno!
Hi Guys,
is it also possible to get through javascript, the time a e-learning is running yet?
Hi Bruno, can you be more specific about what you intend to achieve?
Regards.
I would like to use the time a trainee is in in the training as a variable to use it in gamification scoring.
Not the time of a specific slide but the total time
You would need to do a calculation based on entry time and then exit time, not sure how reliable this would be if they resume
And how can I retrieve these times?
Hi Bruno,
check this out and let me know if its what your looking for. The example has:
http://informatic.com.pt/storyline/timer/
Regards.
Hi Nuno
this looks very much like s'thing I would like. But with the timer invisible
How did you do this?
Hi Bruno, I thought you wanted the timer visible :)
Here is the .story file.
Feel free to explore it!
Hi Nuno
do you think it would be possible to get the timer invisible?
Hey Bruno,
The Timer is in the Master Slide. Go there and set it state to Hidden or simply drag it outside the visible area. :)
Check the attachment.
Hi, Bruno -- I see that Nuno and Phil are helping you out here, but please feel free to let us know if you should need anything further. :)
This discussion is closed. You can start a new discussion or contact Articulate Support.