Creating a "MM:SS" style clock with one event



541 visits, 620 views


This tutorial hasn't been translated.


Based on the method by strevor73

I've seen a few tutorials on how to do this but they all use multiple objects or variables. It's possible to do this however with just one variable and one event.

The first action adds 1 to the timer. Please note that whilst you can just add 1, using "dt * 60" will use delta time (a fancy way of saying it accounts for lag).

Then comes converting the time into a "mm:ss" format (minutes:seconds).

To do this, we set the text to:

floor(Clock/60) & ":" & floor((Clock%60)/10) & floor(Clock%10)

Let's break it down:


Displays the minutes. By dividing by 60 we get a number that will increase by 1 every 60 intervals.


The "%" sign gives us the remainder, so basically everything left over that isn't divisible by 60. This would give us the seconds. However, by dividing by 10 and removing anything past the decimal, we only get the 10s.


Gives us the remainder of everything but the 10s. Uses floor() to remove delta time inaccuracies. Displays the single digit seconds.

That's pretty much all there is. It's worth noting you may want to set the default text to "0:00". Additionally, using "every X seconds" will not reset on it's offset, so if you need precise resetting time I'd recommend the timers behavior.

That's everything, hope it helps.


Added floor() to the seconds do incorporate delta time.


  • Order by
Want to leave a comment? Login or Register an account!