Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » If anyone knows how to make a Hour, minute, second, and millisceond stopwatch, can you please post a picture here?
- hieratic
-
Scratcher
31 posts
If anyone knows how to make a Hour, minute, second, and millisceond stopwatch, can you please post a picture here?
Thank you in advance!
- JplaysStuff
-
Scratcher
100+ posts
If anyone knows how to make a Hour, minute, second, and millisceond stopwatch, can you please post a picture here?
I think it's just a simple loop script.
Just change the time delay as needed for different increments.
when green flag clicked
set [seconds] to [0]
forever
wait (1) secs
change [seconds] by (1)
end
Just change the time delay as needed for different increments.
- scratch978654
-
Scratcher
100+ posts
If anyone knows how to make a Hour, minute, second, and millisceond stopwatch, can you please post a picture here?
I think it's just a simple loop script.That won't work due to screen refresh, just add it into a custom block without screen refresh.when green flag clicked
set [seconds] to [0]
forever
wait (1) secs
change [seconds] by (1)
end
Just change the time delay as needed for different increments.
- PinkShower
-
Scratcher
57 posts
If anyone knows how to make a Hour, minute, second, and millisceond stopwatch, can you please post a picture here?
when green flag clickedYou can set the Variables to Normal or Large Readout
set [ Milliseconds v] to [0]
set [ Seconds v] to [0]
set [Minutes v] to [0]
set [ Hours v] to [0]
forever
wait ((1) / (1000)) secs
change [Milliseconds v] by (1)
if <(Milliseconds) = [1000]> then
set [Milliseconds v] to [0]
change [Seconds v] by (1)
end
if <(Seconds) = [60]> then
set [Seconds v] to [0]
change [Minutes v] by (1)
end
if <(Minutes) = [60]> then
set [Minutes v] to [0]
change [Hours v] by (1)
end
end
This stopwatch will start from zero when flag is clicked and stop when the Stop button is clicked. You can put this script anywhere.
If you want to put a start button, you have to put the above script in the Start Button sprite and substitute
when green flag clickedwith
when this sprite clicked.
For a reset button,
when this sprite clicked
set [ Milliseconds v] to [0]
set [ Seconds v] to [0]
set [Minutes v] to [0]
set [ Hours v] to [0]
If you want to include a reset button, do not include
set [ Milliseconds v] to [0]in the first script.
set [ Seconds v] to [0]
set [Minutes v] to [0]
set [ Hours v] to [0]
For a stop button,
when this sprite clicked
stop [All v]
- deck26
-
Scratcher
1000+ posts
If anyone knows how to make a Hour, minute, second, and millisceond stopwatch, can you please post a picture here?
The built in timer is a better option and doesn't vary because loops are running slow etc.
- Oumuamua
-
Scratcher
1000+ posts
If anyone knows how to make a Hour, minute, second, and millisceond stopwatch, can you please post a picture here?
- Oumuamua
-
Scratcher
1000+ posts
If anyone knows how to make a Hour, minute, second, and millisceond stopwatch, can you please post a picture here?
I think it's just a simple loop script.That won't work due to screen refresh, just add it into a custom block without screen refresh.when green flag clicked
set [seconds] to [0]
forever
wait (1) secs
change [seconds] by (1)
end
Just change the time delay as needed for different increments.
Since there is a waiting block your solution would not work.
- Oumuamua
-
Scratcher
1000+ posts
If anyone knows how to make a Hour, minute, second, and millisceond stopwatch, can you please post a picture here?
You see if this helps some way https://scratch.mit.edu/projects/396834081/The project above calculates the difference between a start point set to days since 2000 and, since 2000 when stops.
The project below is a timer(block) based. I have not fully tested but it should work, perhaps.
https://scratch.mit.edu/projects/396980582/ I did a little mistake in this(not taking into account msecs.), it is now fixed.
Last edited by Oumuamua (May 19, 2020 18:11:49)
- 77wolfster
-
Scratcher
48 posts
If anyone knows how to make a Hour, minute, second, and millisceond stopwatch, can you please post a picture here?
There is a “timer” varible in the sensing blocks if you click it then it will start the timer.
(timer)
- Paigeri
-
Scratcher
500+ posts
If anyone knows how to make a Hour, minute, second, and millisceond stopwatch, can you please post a picture here?
Thank you in advance!As many others' said, there's no reason to make your project harder than you need it to be! ^^ Feel free to use the timer block to make your projects easier!
- LanaZC
-
Scratcher
100+ posts
If anyone knows how to make a Hour, minute, second, and millisceond stopwatch, can you please post a picture here?
set [seconds v] to [][scratchblocks]I think these are the blocks you use
change [seconds v] by (1)
when green flag clicked
forever
end
[/scratchblocks]
Last edited by LanaZC (May 25, 2020 07:47:16)
- hieratic
-
Scratcher
31 posts
If anyone knows how to make a Hour, minute, second, and millisceond stopwatch, can you please post a picture here?
set [seconds v] to [][scratchblocks]I think these are the blocks you use
change [seconds v] by (1)
when green flag clicked
forever
end
[/scratchblocks]
This Topic was already finished, as i got help a while ago, please don't post in topics that are already done
- SpideyPlaysMC
-
Scratcher
500+ posts
If anyone knows how to make a Hour, minute, second, and millisceond stopwatch, can you please post a picture here?
Since this is resolved I will close the topic.
- Discussion Forums
- » Help with Scripts
-
» If anyone knows how to make a Hour, minute, second, and millisceond stopwatch, can you please post a picture here?