How to make a timer



This tutorial got 50% out of 8 voters so this is a tutorial about making a timer.
**Note: ** The text in brackets are values.
Instead of parentheses put in how long you want the timer to run for.
Create a text for your timer. Inside of the text:

When play button is tapped

Set value [timer] to ()
Repeat () {
Check Once If [timer] > 0 {
Set text to [timer]
Wait 1000
Increase value [timer] by -1

Feedback appreciated!

Help with timed games
How do I make a clock

Could you add a picture of the code please? I'm more of visual learner. You can take a screen shot by pressing the home button and off button at the same time! :smiley:


Great tutorial @NDSDNS! @Codingiscool, here's a picture.
I changed it slightly by using a Repeat without the Check Once If instead of Repeat Forever because when I did that it didn't go all the way to zero.


Thank you so much, @CreativeCoder and @NDSDNS


I am not at the house with my iPad.


997 milliseconds would be more accurate, it does take some time for the code to operate, but that would only make a real difference if you're timing something down to a 10th of a second


well, races, 1/10 of a second slower would cost 1.3 meters for an Olympic medalist's 100 meter dash time, running 100 meters in the time that he could have ran 101.3 meters if he were have a .1 second faster time, and anybody who does track would tell you that 1.3 meters is a big difference when you're trying to catch up to the person in front of you at a full sprint


If the set value/change value/set text were all in seperate command blocks they would start at the same time and not after each other like in the code pics here.


Yes, but the code runs really fast. I mean, The Hopscotch Team is probably using Swift and it's iOS so it should be almost instant.


that's the point though, if you're measuring how much time it takes for light to travel an infinitely small distance, almost instant isn't good enough

(sorry I've been talking with oio about dimensions for the past 3 hours) but even though that almost instant moment in time is, like you said almost instant, and unnoticeable to the human eye, it is stil almost, and to a perfectionist almost isn't good enough, and good enough isn't good enough, because good enough isn't perfect.


I am from the fuuture!


It does not help for me. Please could you screenshot a more detailed screenshot. It's partially because I'm using an Apple iPad air 2.


Can I have a video of how to do the code please?