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

1
• 1 favourites

### Stats

892 visits, 1,044 views

### Translations

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:

floor(Clock/60)

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

floor((Clock%60)/10)

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.

floor(Clock%10)

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.

Edit

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

• Order by
• Works fine, thanks.

• [deleted]
• Thanks for the feedback, however, I can't really do much to improve with just "trash". Could you elaborate on the issue?