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

#1 2009-01-18 13:09:48

i_caught_fire_2
Scratcher
Registered: 2008-12-23
Posts: 20

Help With My Menu!

My menu is being all whacked out. About 90% of the tie, if you go in to either 1 player or 2 player, and then hit the green flag again, it will go to the menu but some stuff will be missing or it will show the 1 player and 2 player options that shouldn't be there yet.

HELP!!




http://scratch.mit.edu/projects/i_caught_fire_2/385230

Offline

 

#2 2009-01-18 13:33:52

i_caught_fire_2
Scratcher
Registered: 2008-12-23
Posts: 20

Re: Help With My Menu!

Bumpity Bumo Bump

Offline

 

#3 2009-01-18 14:51:20

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

Re: Help With My Menu!

i_caught_fire_2 wrote:

My menu is being all whacked out. About 90% of the tie, if you go in to either 1 player or 2 player, and then hit the green flag again, it will go to the menu but some stuff will be missing or it will show the 1 player and 2 player options that shouldn't be there yet.

HELP!!




http://scratch.mit.edu/projects/i_caught_fire_2/385230

This kind of problem is usually caused by timing issues.  Scratch would like you to think that everything under the Green Flag blocks run at the same time but that is not exactly true...some of them will run before others and some scripts will run faster than others.  So take a close look at how the project is being initialized with the Green Flag scripts and maybe add in a few Wait 0.5 second blocks here and there to make sure that things are running in an order that makes sense.

For instance, in your project I see a lot of Forever Loops testing on a variable called Play Amount.  They start testing on it immediately from Green Flag...but what if the variable value hasn't been initialized to the correct value yet before those loops start looking at it?  It would be a very good idea to add a short Wait between the Green Flag and any block that tests on the value of the Play Amount variable. 

Hope that helps out some!


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

Offline

 

#4 2009-01-18 14:57:23

mrweston
Scratcher
Registered: 2007-12-13
Posts: 100+

Re: Help With My Menu!

Speaking of which...

I've always been curious about how Scratch handles multiple threads like that... There must be some sort of logic behind how it chooses the order in which to start running each Flag script -- are there any docs on how the interpreter actually runs?

Offline

 

#5 2009-01-18 20:29:17

bosox397
Scratcher
Registered: 2008-02-17
Posts: 1000+

Re: Help With My Menu!

maybe its which order the scripts are in and the sprites are in. LIke sprite one would be first and so on. and then the topmost script of the first sprite would be first, ect.


Dear Scratch Users,
I'm done with scratch, or at least making projects. I have made one last big game, thats both fun and teaches a lesson about water. It'd mean a lot if you gave me feedback.                              http://scratch.mit.edu/projects/bosox397/569201

Offline

 

#6 2009-01-18 21:25:42

hmnwilson
Scratcher
Registered: 2007-07-04
Posts: 1000+

Re: Help With My Menu!

I always thought each script started at the same time, but some blocks took longer to activate than others. Like if you had a forever loop in one script and a set variable script in the other. Then when you start both scripts, it would take longer for the set variable block to activate than the forever loop.

I'm probably wrong, though.


I'm taking a break from Scratch until 2.0 comes out. Any messages sent between then and now probably won't be read - sorry.
(Oct. 20, 2011)

Offline

 

#7 2009-01-18 22:44:47

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

Re: Help With My Menu!

hmnwilson wrote:

I always thought each script started at the same time, but some blocks took longer to activate than others. Like if you had a forever loop in one script and a set variable script in the other. Then when you start both scripts, it would take longer for the set variable block to activate than the forever loop.

I'm probably wrong, though.

Well, all I'm saying is that without true parallel processing, each script must start sequentially.  They may be very close in timing but there has to be very slight differences.  You are correct in saying that each block must have different activation times as well.  And it is also true that the timing can change a lot between the Scatch application and the Java player.  So if you have a series of actions that need to happen sequentially, it is a very good idea to use Wait blocks (or other methods) to insure that they happen the way you want them to.


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

Offline

 

#8 2009-01-18 22:46:53

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

Re: Help With My Menu!

mrweston wrote:

Speaking of which...

I've always been curious about how Scratch handles multiple threads like that... There must be some sort of logic behind how it chooses the order in which to start running each Flag script -- are there any docs on how the interpreter actually runs?

There was a discussion on the Forums awhile back...initiated by Deerel I think.  I'll look around and see if I can find it.

Here it is...it has a fascinating post from Johnm, the chief developer.

http://scratch.mit.edu/forums/viewtopic.php?pid=72942#p72942


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

Offline

 

Board footer