Discuss Scratch

kingKASEtheGREATalt
Scratcher
100+ posts

How do you add milliseconds to scratch?

I want to add milliseconds to my scratch project but it wont change every millisecond heres my code:

set [ milliseconds] to ((seconds) / (1000))
wait (0.0001) secs

But it changes every second can anyone help?

Last edited by kingKASEtheGREATalt (Feb. 22, 2021 23:56:07)

Jareddddddd
Scratcher
1000+ posts

How do you add milliseconds to scratch?

theres no way to do this other than to manually time the milliseconds
kingKASEtheGREATalt
Scratcher
100+ posts

How do you add milliseconds to scratch?

Jareddddddd wrote:

theres no way to do this other than to manually time the milliseconds

I did i put a wait i timed it but it changes when the (seconds) variable changes here the code for the seconds:

forever
change [ seconds] by (1)
wait (1) secs
end


Is this why it changes the milliseconds every second?

Last edited by kingKASEtheGREATalt (Feb. 23, 2021 00:18:26)

Recoin
Scratcher
100+ posts

How do you add milliseconds to scratch?

kingKASEtheGREATalt wrote:

Jareddddddd wrote:

theres no way to do this other than to manually time the milliseconds

I did i put a wait i timed it but it changes when the (seconds) variable changes here the code for the seconds:

forever
change [ seconds] by (1)
wait (1) secs
end


Is this why it changes the milliseconds every second?
milli = thousand.

You should do this:
forever
change [milliseconds v] by (1)
wait (0.001) secs
end
Jareddddddd
Scratcher
1000+ posts

How do you add milliseconds to scratch?

one sec. there is a way
change [miliseconds v] by (timer)
reset timer
Jareddddddd
Scratcher
1000+ posts

How do you add milliseconds to scratch?

Recoin wrote:

kingKASEtheGREATalt wrote:

Jareddddddd wrote:

theres no way to do this other than to manually time the milliseconds

I did i put a wait i timed it but it changes when the (seconds) variable changes here the code for the seconds:

forever
change [ seconds] by (1)
wait (1) secs
end


Is this why it changes the milliseconds every second?
milli = thousand.

You should do this:
forever
change [milliseconds v] by (1)
wait (0.001) secs
end
that also isnt right though, as scratch is inconsistant when it comes to wait blocks, as 1 seconds waiting in a wait block is more than 1 second (very slightly albeit). This effect amplifies with smaller waits
aceyp9000
Scratcher
100+ posts

How do you add milliseconds to scratch?

In theory, the smallest unit of time that can be used in a wait block is 1/30 or around 3.3ms, assuming the project is running perfectly at 30 FPS. Scratch cannot recognize a unit of time smaller than 1/30 since Scratch runs at 30 fps at the maximum.
This may work if you use an external website to run the project at a higher frame rate.
Wax01
Scratcher
35 posts

How do you add milliseconds to scratch?

How to time milliseconds
when green flag clicked
forever
set [ millisecond] to ((timer) * (1000))
end
How to make a variable = timer
when green flag clicked
forever
set [ Unknown variable] to (timer)
end

say [Follow 4 a cookie :)] for (2) secs

https://scratch.mit.edu/projects/722696110/ (Live Stream: 10000 days since 1996! “Not spam”)

Last edited by Wax01 (Aug. 19, 2022 23:26:02)

Wax01
Scratcher
35 posts

How do you add milliseconds to scratch?

Wax01
Scratcher
35 posts

How do you add milliseconds to scratch?

Recoin wrote:

kingKASEtheGREATalt wrote:

Jareddddddd wrote:

theres no way to do this other than to manually time the milliseconds

I did i put a wait i timed it but it changes when the (seconds) variable changes here the code for the seconds:

forever
change [ seconds] by (1)
wait (1) secs
end


Is this why it changes the milliseconds every second?
milli = thousandth.

You should do this:
forever
change [milliseconds v] by (1)
wait (0.001) secs
end
legendary34678
Scratcher
1000+ posts

How do you add milliseconds to scratch?

Hello! Please don't necropost on old topics. Thanks!

Powered by DjangoBB