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

#1 2012-08-28 21:55:10

zubblewu
Scratcher
Registered: 2011-02-17
Posts: 1000+

Multiple timers

Just something I thought of. Let me give you a scenario: you have a bunch I time base things that have to be precise. You use the forever/repeat blocks. It fails miserably. Another thing: you need multiple timed things but you want a 2"1s1s. How are you going to do that? So anyway, this is my idea.


........................................................................................................................................................................................................................................

Offline

 

#2 2012-08-28 22:07:24

jvvg
Scratcher
Registered: 2008-03-26
Posts: 1000+

Re: Multiple timers

Sounds like a good idea. Support.


http://tiny.cc/zwgbewhttp://tiny.cc/e1gbewhttp://tiny.cc/zygbewhttp://tiny.cc/izgbew
Goodbye, Scratch 1.4  sad                                                        Hello Scratch 2.0!  smile

Offline

 

#3 2012-08-28 22:23:37

Wes64
Scratcher
Registered: 2011-08-19
Posts: 1000+

Re: Multiple timers

i think there should be one "master timer" that is the same for every sprite and then a local timer for each sprite


Experienced 2.0 Tester: Ask me questions!
Using Firefox 13.0, Flash plugin version 11.4.402.287, and Windows XP Professional.

Offline

 

#4 2012-08-28 23:50:42

zubblewu
Scratcher
Registered: 2011-02-17
Posts: 1000+

Re: Multiple timers

Maybe a master timer, but make timers available like variables? So any timer can be used on any sprite. This could also help communication between sprites. Maybe also a reset all timers block to.


........................................................................................................................................................................................................................................

Offline

 

#5 2012-08-29 03:22:09

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

Re: Multiple timers

Why can't you make your own timer?


http://i.imgur.com/gp6tZ.gif

Offline

 

#6 2012-08-29 04:45:51

joefarebrother
Scratcher
Registered: 2011-04-08
Posts: 1000+

Re: Multiple timers

benjamin2 wrote:

Why can't you make your own timer?

you might want a 1s1s project

Also if scratch slows down, it might put your timer off-track a bit.


My latest project is called http://tinyurl.com/d2m8hne! It has http://tinyurl.com/d395ygk views, http://tinyurl.com/cnasmt7 love-its, and http://tinyurl.com/bwjy8xs comments.
http://tinyurl.com/756anbk   http://tinyurl.com/iplaychess

Offline

 

#7 2012-08-29 22:37:51

thebriculator
Scratcher
Registered: 2011-07-11
Posts: 500+

Re: Multiple timers

Support. You should be able to make a new timer just like a broadcast.
I had the idea here, under "sensing"


.     http://tiny.cc/2cwgpw    http://tiny.cc/viwgpw    http://tiny.cc/iwwgpw

Offline

 

#8 2012-08-29 23:15:23

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

Re: Multiple timers

when gf clicked
set [start time v] to (timer)
forever
  say ((timer) - (start time))
end


http://block.site90.net/scratch.mit/text.php?size=30&text=%20A%20signature!&color=333333

Offline

 

#9 2012-09-01 01:32:34

zubblewu
Scratcher
Registered: 2011-02-17
Posts: 1000+

Re: Multiple timers

True, but there are all kinda of issues like that, it won't be the correct time. It would be slightly off, which could throw the whole project off balance


........................................................................................................................................................................................................................................

Offline

 

#10 2012-09-01 05:26:50

joefarebrother
Scratcher
Registered: 2011-04-08
Posts: 1000+

Re: Multiple timers

workaround:

when gf clicked
reset timer
delete (all v) of [timers v]

when i receive [reset timer v]
if <(timer id) > (length of [timers v])>
 add (timer) to [timers v] //save the starting time
else
 replace item (timer id) of [timers v] with (timer)
end

when i receive [get timer v]
set [result v] to ((timer) - (item (timer id) of [timers v])) //how much time since the last reset
Then, to reset a timer, set (timer id) to the number of the timer and broadcast [reset timer]

To get the value of a timer, set (timer id) to the number of the timer, broadcast [get timer], and the answer will be in the variable (result)

Don't use the reset timer block or all the timers you have so far will go off track.

Last edited by joefarebrother (2012-09-01 05:28:30)


My latest project is called http://tinyurl.com/d2m8hne! It has http://tinyurl.com/d395ygk views, http://tinyurl.com/cnasmt7 love-its, and http://tinyurl.com/bwjy8xs comments.
http://tinyurl.com/756anbk   http://tinyurl.com/iplaychess

Offline

 

#11 2012-09-01 18:40:42

xJira
Scratcher
Registered: 2012-03-24
Posts: 91

Re: Multiple timers

I've thought about that before as well. Totally support it!
Its one of the things I really missed in the past D:

Offline

 

#12 2012-09-01 18:45:44

Molybdenum
Scratcher
Registered: 2012-06-17
Posts: 1000+

Re: Multiple timers

([timer v] of [Sprite1 v])
Would that work for local/global?

Last edited by Molybdenum (2012-09-01 18:46:06)


"The Enrichment Center is required to remind you that you will be baked, and then there will be cake."
(|Balls and Platforms: Stay on!|) (|NaOS-H: An operating system... Or is it?|)

Offline

 

Board footer