Forum Discussion
Capturing static course runtime
- 22 days ago
System variables like Project.Elapsedtime are unfortunately not accessible to our triggers, I don't think, or certainly not all of the triggers.
I mocked up and attached a quick demo of a solution that relies on a JavaScript trigger placed on the top-most master slide. It's set to Execute when the timeline starts on this slide, which means it runs whenever any slide is loaded.
// Checks if a startTime variable has been created yet, and if not, makes one.
if (!window.startTime) {
window.startTime = Date.now();
};
const elapsedTime = Date.now() - window.startTime;
const minutes = Math.floor(elapsedTime / 60000);
const seconds = Math.floor((elapsedTime % 60000) / 1000);
// Use padStart to ensure seconds always has two digits
const tidyTime = `${minutes}:${seconds.toString().padStart(2, '0')}`;
setVar('tidyTime', tidyTime);Naturally for it to work, you'll need to create a Storyline text variable called tidyTime. The demo project has two slides which you can navigate back and forth between. That allows you to see the variable update only when the slide is loaded, hopefully providing less distraction to your learners than thousands of milliseconds flying by.
You would have to use a custom variable equal to Project.ElapsedTime and convert it to seconds (or any other time format such as mm:ss), then use a trigger with any event that will capture or freeze the elapsed time. See example below:
Of course, in the published output, you would hide the Project.ElapsedTime reference on the slide and use its equivalent custom variable instead, formatted in a more user-friendly way.
Related Content
- 7 months ago