This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2013-01-17 23:54:52

Spaxxy
New Scratcher
Registered: 2013-01-14
Posts: 35

High-resolution timer in Scratch

For a project, I need to have a high-resolution timer (For animation). However, the default, built in timer will not do. Is there any way to make a high-resolution timer in Scratch without a mod?

Offline

 

#2 2013-01-18 15:03:51

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: High-resolution timer in Scratch

Spaxxy wrote:

For a project, I need to have a high-resolution timer (For animation). However, the default, built in timer will not do. Is there any way to make a high-resolution timer in Scratch without a mod?

Well the built in timer goes to the thousands place*, and the most accurate timer you could get would be accurate to the nearth 40th of a second, so no, there isn't a way.

* - You have to click the variable to see this; you can't just have the variable showing.

I hope that this helps! Alo hello Spaxxy and welcome to Scratch! I wish you much joy here!  smile

Last edited by ErnieParke (2013-01-18 15:04:20)


http://i46.tinypic.com/35ismmc.png

Offline

 

#3 2013-01-18 15:43:36

Froggy4444
New Scratcher
Registered: 2013-01-17
Posts: 4

Re: High-resolution timer in Scratch

Use a timer variable, but if it counts down it will only go to the nearest whole second.

(timer)

Offline

 

#4 2013-01-18 21:40:10

technoguyx
Scratcher
Registered: 2008-10-18
Posts: 1000+

Re: High-resolution timer in Scratch

The "timer" block is precise to the milisecond, that should be more than enough for animations. I did a "fade in" effect for this project using said block, and it works smoothly.


http://getgnulinux.org/links/en/linuxliberated_4_78x116.png

Offline

 

#5 2013-01-19 04:19:51

Spaxxy
New Scratcher
Registered: 2013-01-14
Posts: 35

Re: High-resolution timer in Scratch

technoguyx wrote:

The "timer" block is precise to the milisecond, that should be more than enough for animations. I did a "fade in" effect for this project using said block, and it works smoothly.

It's been some time since I used Scratch, and I wasn't sure how precise the built in timer was. Since it only shows to the tenth of a second, I assumed that was how accurate it was.

Offline

 

#6 2013-01-19 10:23:54

amcerbu
Scratcher
Registered: 2009-07-21
Posts: 500+

Re: High-resolution timer in Scratch

Yeah; I use it to lock framerates when I make projects intended for turbo mode, and it works pretty well. 

The format for locking the framerate is something like this:

when gf clicked
broadcast [Initialize v] and wait
forever
reset timer
broadcast [Update v] and wait
broadcast [Draw v] and wait
wait until <(timer) > ((1) / (30))> 
end

Last edited by amcerbu (2013-01-19 10:24:11)

Offline

 

Board footer