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

#1 2012-11-03 13:31:13

awnothecorn
New Scratcher
Registered: 2012-11-03
Posts: 1

Conditionals with Timer Are Not Working

Good afternoon,

I'm working on a game that is time and score dependent, i.e. you have thirty seconds for the whole game. What your score is by the end of the game depends on if you win or if you lose, but whenever I put in a conditional command ("if score=30 and timer<30") it doesn't work. Even my stop all script commands ("when timer = 30" stop all) do not seem to be going through. Any advice? I'm very new to Scratch and need this for a homework assignment. Thanks!

Offline

 

#2 2012-11-03 13:32:40

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

Re: Conditionals with Timer Are Not Working

awnothecorn wrote:

Good afternoon,

I'm working on a game that is time and score dependent, i.e. you have thirty seconds for the whole game. What your score is by the end of the game depends on if you win or if you lose, but whenever I put in a conditional command ("if score=30 and timer<30") it doesn't work. Even my stop all script commands ("when timer = 30" stop all) do not seem to be going through. Any advice? I'm very new to Scratch and need this for a homework assignment. Thanks!

Use when timer > 30 stop all, since timers never equal an exact number.


"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

 

#3 2012-11-03 13:34:06

Willpower
Scratcher
Registered: 2012-01-26
Posts: 1000+

Re: Conditionals with Timer Are Not Working

awnothecorn wrote:

Good afternoon,

I'm working on a game that is time and score dependent, i.e. you have thirty seconds for the whole game. What your score is by the end of the game depends on if you win or if you lose, but whenever I put in a conditional command ("if score=30 and timer<30") it doesn't work. Even my stop all script commands ("when timer = 30" stop all) do not seem to be going through. Any advice? I'm very new to Scratch and need this for a homework assignment. Thanks!

aha, if the timer is running for the whole game you need a "forever" block before the condition otherwise without the forever if you wanted the timer to start when the green flag was pressed it would check if the timer = 30 when the green flag is pressed and then the script will stop.

Ah, i have just written all that ^ and realised i might not be answering the right problem, does it help or am i going down the wrong track?

EDIT- outposed by Molybdenum  sad

Last edited by Willpower (2012-11-03 13:37:51)


http://i49.tinypic.com/e84kdj.png

Offline

 

#4 2012-12-13 06:35:10

krzysiogawl01
Scratcher
Registered: 2012-05-02
Posts: 13

Re: Conditionals with Timer Are Not Working

Answer:

When green flag clicked
Reset timer
Wait until <<(timer) = [30]> or <(timer) > [30]>>
Stop all


Don't know how to make a 0s1s stopwatch?
http://scratch.mit.edu/static/icons/buddy/1350608_med.png

Offline

 

Board footer