[Partially Solved] Change Timer Variable

So, I’ve managed to get a timer going for my Super Mario Bros. fangame, but the problem is two things:

  • I need to have the timer display the first 0 when counting down below 100 (“099” vs “99”).
  • I need to increment the countdown of the timer for “Mario” seconds (0.4 real-time seconds)

If anyone could please help out with either of those things, it would be greatly appreciated!

Here’s a link to a previous thread that has a number of solutions for the leading ‘0’ query.

As for the Mario seconds, you don’t need to have the timer actually increasing at 0.4 of the actual rate, it’s just the output that needs to show this. So set the display timer = timer value * 0.4

Oh wow, I didn’t know that had been asked before. Also, I don’t know I would go about doing that with the current code I have. I’m not much of a coder, so I copied it from a YouTube video and changed the value to fit my needs:




I don’t know why you’re taking 400 off the elapsed timer. I’d use ToString(round(TimerElapsedTime("TIME_COUNT")*0.4))

Well, because that’s from the YouTube video I found for making a countdown timer, and I need it to know that I want the timer to start at 400 seconds.

Oh and just to make it clear, I want the timer to count down from 400 by 0.4 second.

Gotcha. In that case, use ToString(round(0.4 * abs(TimerElapsedTime("TIME_COUNT")-400)))

[edit] I posted just as you edited yours. So you want the 400 second delay to countdown at 0.4 pace? Or after it’s hit 400? Or all the time?

Shoot, that’s no good either… first off, it starts me from 160 seconds and actually makes the second longer, not shorter.

I want the timer to start displayed at 400 seconds and begin counting down by 1 every 0.4 (2/5 of a second)

Ok, that’s the same as it being 2.5 times the speed of the timer. In which case, use ToString(round(max(0, 400 - (TimerElapsedTime("TIME_COUNT")* 2.5)))).

So you start at 400, and take off the elapsed timer value until it gets to 0.

[edited] - changed abs to max

Holy moly, that worked like a charm! Thank you so much! Now to see how I can get it reformatted so that
99 seconds = "099"
9 seconds = "009"