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

#1 2011-02-09 22:26:22

ian528
Scratcher
Registered: 2010-05-25
Posts: 500+

Click Green Flag twice

This is a glitch I've seen with online projects.
The project only works if you press the flag twice.
Can anyone fix it?
How is it caused?

Offline

 

#2 2011-02-09 23:22:38

hdarken
Scratcher
Registered: 2008-06-26
Posts: 1000+

Re: Click Green Flag twice

It has never happened to me, and I wonder why it would.


http://i.imgur.com/VskBk.png
http://i.imgur.com/tgxVZ.jpg

Offline

 

#3 2011-02-10 06:07:28

mathematics
Scratcher
Registered: 2009-03-01
Posts: 1000+

Re: Click Green Flag twice

Usually it's because there's a script like this in the project:
[blocks]<when green flag clicked>
<forever if> <something>
<stop all>
<end>[/blocks]
To fix that insert a "wait 0.1 secs" block in between "when green flag clicked" and "forever if".

Last edited by mathematics (2011-02-10 06:07:53)

Offline

 

#4 2011-02-10 07:39:48

ian528
Scratcher
Registered: 2010-05-25
Posts: 500+

Re: Click Green Flag twice

OK. Mods, close topic!

Offline

 

#5 2011-02-10 07:45:17

demosthenes
Retired Community Moderator
Registered: 2008-02-19
Posts: 1000+

Re: Click Green Flag twice

Closing  smile

EDIT: Heh looks like I missed the boat on this one. Topic was already closed when I got here  wink

Last edited by demosthenes (2011-02-10 07:45:46)


I've taken a long hiatus, but I still visit sometimes. Give me some time to answer any messages you post on my projects!

Offline

 

#6 2011-02-10 07:46:00

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: Click Green Flag twice

Closed by request of the topic owner.

To expand just a bit on what mathematics pointed out above...it's caused by not giving the project time to initialize variables and conditions before they are tested.  The cure is to put a short wait ahead of any block that tests on a variable or condition to give them time to be properly initialized.  And, of course, to make sure that they have a block somewhere that does the initialization  smile


http://i39.tinypic.com/2nav6o7.gif

Offline

 

Board footer