Adding a timer to my storyline file

I have a client who has the requirement of their users to only do elearning for 5 hours per day. I wanted to add a timer that countdowns the 5 hours and then it prompts them to quit the course.

I know SL3 has a built in timer via the results slide that you can set for the entire course. This is awesome, except I need the timer to reset when a user resumes. So far the timer can only resume where it left off and I am struggling to figure out how to reset it.

I also found a timer from 4 years ago and I have modified it to add the hours (was originally minutes and seconds) but it is not subtracting the hours properly. 

How it should work is when the minutes get to zero then it resets to 59 and the hours should subtract by 1. So it works, but then when the minutes gets to 58 it starts subtracting the hours again.

I am desperate to find a solution for my client. They do not want any coding if at all possible.

Thanks in advance.

5 Replies
Matthew Bibby

Just linking to your other discussion from here as the background info might help others suggest an appropriate solution.

If you don't want to use JavaScript to do this, then there are other timers that people in the community have built that might help. For example, see here or here. And there are lots of others if you dig through the forums.

Regarding this:

I need the timer to reset when a user resumes. So far the timer can only resume where it left off and I am struggling to figure out how to reset it.

While it shouldn't be too hard to reset the timer, you'd also need a way of determining if it is the same day or not. Things will start getting tricky here for a few reasons and as I said in your other post, it would be easy to bypass if someone wanted to. 

Personally, I think adding restrictions like this is silly. I know it's a client requirement, but that doesn't mean it's the right way to go!

I mean really... who is going to want to do more than 5 hours of eLearning in a day anyway! I don't care how amazing a course is, I'm out way before I hit the 5-hour mark. 

Maybe talk to your LMS admin to see if there is anything that they can do on their side?

And if I was you, I'd also be pushing back regarding a 20-hour long course. Break things up a bit. Be kind to your learners. Attention needs to be respected. 

Dig into why they need this 5 hour per day limit? Is it because people are starting a course and letting it run for hours without paying any attention to it? Because if so, adding a technical solution here isn't the answer. 

Anyway, that's enough from me. All the best.

Wendy Bouchard

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">

Thanks for your reply. I have looked at other options for a timer and I found one but I am having issues with the hours as it was originally created with just min and secs.
My client is a government agency and they have specific requirements and those include: no coding of any kind, the entire course is 20 hours and no longer than 5 hours per day.
I know it is an absurb requirement but it is what it is at this point. 
Thanks again

Matthew Bibby

Hours can be tricky.

I know it probably sounds silly, but when using JavaScript for a timer, the time can drift for a few reasons. For example, if using a basic setTimeout() or setInterval() approach, they may not execute accurately (due to demands on system resources by the browser or operating system). 

So a timer that will be acceptably accurate for a 10-minute countdown, may not be reliable over a longer period of time. There are more advanced ways of approaching this that allows the timer to self-correct when the time drifts. But it sounds like you couldn't use this approach anyway due to the "no coding of any kind" rule.

I find this to be another interesting rule. Do they know that Storyline uses a lot of code to make these courses work? Adding a little additional JavaScript won't introduce any risk... but governments gotta govern something I guess!

So if you can't use JavaScript, you'll have to use the motion path or layer approach. I suspect that these also won't keep time accurately over a five hour period, but I haven't tested it so can't say for sure.