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

#1 2012-10-04 10:13:39

gathompsonHD
New Scratcher
Registered: 2012-10-04
Posts: 4

How Do You Make a Variable for a Timer?

I want to add a timer to my assassin Scratch game, but I don't know how to make a timer that isn't the annoying default timer. Any tips/ideas?

Offline

 

#2 2012-10-04 10:49:01

mythbusteranimator
Scratcher
Registered: 2012-02-28
Posts: 1000+

Re: How Do You Make a Variable for a Timer?

1. Go to help with scripts.
2. Do something like
forever
change var (timer variable) by (0.01)
end


as 0.01 is the default time in between scripts running, I believe.


http://www.foxtrot.com/comics/2012-04-01-fdb37077.gif
clicky

Offline

 

#3 2012-10-04 10:56:32

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

Re: How Do You Make a Variable for a Timer?

when gf clicked
set [mytimer v] to [0]
forever
wait (.1) secs
change [mytimer v] by (.1)
end

Last edited by jvvg (2012-10-04 10:56:46)


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

Offline

 

#4 2012-10-04 11:42:46

roijac
Scratcher
Registered: 2010-01-19
Posts: 1000+

Re: How Do You Make a Variable for a Timer?

mythbusteranimator wrote:

1. Go to help with scripts.
2. Do something like
forever
change var (timer variable) by (0.01)
end


as 0.01 is the default time in between scripts running, I believe.

jvvg wrote:

when gf clicked
set [mytimer v] to [0]
forever
wait (.1) secs
change [mytimer v] by (.1)
end

first one will depend heavily on how many scripts run, and second will also fail because the execution engine isn't really exact about timing. what's bad about the normal timer?

Offline

 

#5 2012-10-04 15:19:43

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

Re: How Do You Make a Variable for a Timer?

jvvg wrote:

when gf clicked
set [mytimer v] to (0)
forever
 wait (.1) secs
 change [mytimer v] by (.1)

Fixed.


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

Offline

 

#6 2012-10-04 16:25:04

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

Re: How Do You Make a Variable for a Timer?

Forever if <timer> > (frequency of incrementing, use .01)
  Reset timer
  Change [MyAwesomeTimer] by [frequency]


"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

 

#7 2012-10-04 16:26:47

Firedrake969
Scratcher
Registered: 2011-11-24
Posts: 1000+

Re: How Do You Make a Variable for a Timer?

Molybdenum wrote:

forever if <timer> > (frequency of incrementing, use .01)
  Reset timer
  Change [MyAwesomeTimer] by [frequency]

Oops, fixed.

Last edited by Firedrake969 (2012-10-04 16:27:34)


Click the sign.
https://s3.amazonaws.com/eterna/eterna2/logo2.png

Offline

 

#8 2012-10-04 17:25:17

dvd4
Scratcher
Registered: 2010-06-30
Posts: 1000+

Re: How Do You Make a Variable for a Timer?

Molybdenum wrote:

when gf clicked
Forever if <(timer) > (frequency of incrementing, use .01)>
Reset timer
Change [MyAwesomeTimer] by [frequency]
 // fixed !


I made a mod  big_smile  It's called blook!
http://i49.tinypic.com/16ia63p.png

Offline

 

#9 2012-10-04 17:27:25

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

Re: How Do You Make a Variable for a Timer?

Firedrake969 wrote:

Molybdenum wrote:

forever if <timer> > (frequency of incrementing, use .01)
  Reset timer
  Change [MyAwesomeTimer] by [frequency]

Oops, fixed.

dvd4 wrote:

Molybdenum wrote:

when gf clicked
Forever if <(timer) > (frequency of incrementing, use .01)>
Reset timer
Change [MyAwesomeTimer] by [frequency]
 // fixed !

How many times do I have to say it. I'm using pseudocode, which is orders of magnitude shorter, easier to write, and flexible.


"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