Forum Discussion
- CaryGlenn1Super Hero
Hi,
I would put those slides in their own scene and then on each slide include a text box with a reference to the built in built-in variable Scene.Elapsed.Time. The only hiccup there is that it counts upwards.
- JimCarryCommunity Member
Feel free to try out the JavaScript code below. Additionally, create a new text variable named 'time' in Storyline, with a default value set to 15 minutes. Execute this script when the timeline starts. I hope you find this helpful!
var player = GetPlayer();
var sec = 900;
function startTimer(){
sec -= 1;
var minutes = Math.floor(sec / 60);
var seconds = sec % 60;
var timeString = minutes.toString().padStart(2, '0') + ":" + seconds.toString().padStart(2, '0');
player.SetVar("time", timeString);
if (sec < 0) {
clearInterval(timerId);
player.SetVar("time", "Time's Up");
}
}var timerId = setInterval(startTimer, 1000);
- EsmeraldaBar868Community Member
Thank you, Jim! I used this code and it worked! I really appreciate it.
- JohnCooper-be3cCommunity Member
Here's a 60 second timer that runs over three screens - it's based on a Start-Pause-Reset timer I had created ages ago - but with a bit of tweaking it seems to work OK. You would have to work out how to make the digital clock display do more that one minute - I have done that in other projects and can look it up if you need it....
This doesn't use ANY Javascript - it's just keeps switching between layers (but, because of that the clock isn't Greenwich atomc clock standard as a result!)