Forum Discussion
MaddieSchroe307
8 months agoCommunity Member
Using Javascript to Gamify a Countdown Timer (incorrect answers subtract time)
Hi all,
Appreciate your help looking into this. What I am trying to do is gamify an activty where there is a countdown where the learner has to type in the correct response before the time runs o...
JohnCooper-be3c
8 months agoCommunity Member
But if you want to stick with JavaScript, I think you just need to retrieve the current value of the timer variable from Storyline each time before you update it.
Putting a line:
let sec = player.GetVar("timer");
Before you decrement the timer would be my initial thought, but I haven't tried it - so other changes might be needed. But the above would allow you to decrement the timer outside of the function (due to an incorrect answer) and still allow the countdown to work.
Hope that helps
John