Help with a timer

Hello everyone; I am trying to make a timer for a game, and I finally got it to be accurate using WoofWoof’s deltaTime extension (Thanks WoofWoof helped a lot!) but I don’t have any idea how to remove all of the 9s following the first three decimals. Can I get some help? Thanks in advance!

Here’s the code I’m using:

3 Likes

First, not my extension. (@Kiwiphoenix364 I didn’t want to drag up your very old topic just to say this, but whatever you have in that “delta” block is frankly completely incorrect, though you were correct in that the normal sprite velocity corrects itself using delta time already.)

You can remove the 9s by rounding. The issue with rounding is that you would lose the extra 3 numbers after the decimal that you don’t want to get rid of. While there is an extension with a block like “Round () to () decimal places”, I really don’t like using an extension if I can easily do it myself. I also forget what that extension is.

What I did was simply store a variable that was the seconds x 1000, round that number, and then divide by 1000 before showing the number:


:)

2 Likes

Oh man I am so sorry about that I got mixed up, credit totally goes to Kiwipheonix364.
Thanks a lot @WoofWoof! I didn’t have a clue that there was a rounding block in Makecode, so I guess I learned something new. Thanks again!

2 Likes