Discuss Scratch

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.

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?

JplaysStuff wrote:

I think it's just a simple loop script.

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.
That won't work due to screen refresh, just add it into a custom block without screen refresh.
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 clicked
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
You can set the Variables to Normal or Large Readout
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 clicked 
with
 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]
set [ Seconds v] to [0]
set [Minutes v] to [0]
set [ Hours v] to [0]
in the first script.

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?

You see if this helps some way https://scratch.mit.edu/projects/396834081/

Oumuamua
Scratcher
1000+ posts

If anyone knows how to make a Hour, minute, second, and millisceond stopwatch, can you please post a picture here?

scratch978654 wrote:

JplaysStuff wrote:

I think it's just a simple loop script.

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.
That won't work due to screen refresh, just add it into a custom block without screen refresh.

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?

Oumuamua wrote:

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?

hieratic wrote:

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]
change [seconds v] by (1)
when green flag clicked
forever

end
[/scratchblocks]
I think these are the blocks you use

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?

LanaZC wrote:

set [seconds  v] to [][scratchblocks]
change [seconds v] by (1)
when green flag clicked
forever

end
[/scratchblocks]
I think these are the blocks you use

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.

Powered by DjangoBB