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

#1 2009-05-05 09:37:09

Zolareelo
Scratcher
Registered: 2009-05-05
Posts: 6

"If" Conditional Troubleshooting

Hey all,

I'm working on a project for school such that I'm trying to create a Mancala game in Scratch. Recently I have been having problems with the "if" conditional. For the game, I need to have approx. 336 "if" conditionals to make the stones move. In my case, the program will spend time checking one conditional, but at the same time continue running the script AFTER the conditional, while the "if" is checking to see if it is T/F and running it's script. In result, the variables get incrediably messed up. What should I do???

Offline

 

#2 2009-05-05 19:27:14

cheddargirl
Scratch Team
Registered: 2008-09-15
Posts: 1000+

Re: "If" Conditional Troubleshooting

It's kind of hard to envision how your code works. Could you upload the project, or could you show us what the script looks like?


http://i.imgur.com/8QRYx.png
Everything is better when you add a little cheddar, because when you have cheese your life is at ease  smile

Offline

 

#3 2009-05-05 22:34:33

ScratchX
Scratcher
Registered: 2009-05-05
Posts: 1000+

Re: "If" Conditional Troubleshooting

try to organize your scripts


Happy New Year!
http://i45.tinypic.com/1nyasi.pnghttp://i50.tinypic.com/219pez8.pnghttp://i49.tinypic.com/e5s4zr.pnghttp://i48.tinypic.com/23l18hf.jpghttp://i49.tinypic.com/66zymu.png

Offline

 

#4 2009-05-06 05:53:19

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

Re: "If" Conditional Troubleshooting

In a single stack of blocks, the IF block will be done in sequence.  That means the blocks following the IF block will not execute until the blocks inside the conditional are done processing or it has been determined that the conditional is false.  Of course, if you fire off another script with a Broadcast block, you can run into sequence problems.  If that is the case, try using the Broadcast and Wait block.


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

Offline

 

#5 2009-05-06 08:24:12

ScratchX
Scratcher
Registered: 2009-05-05
Posts: 1000+

Re: "If" Conditional Troubleshooting

that explais alot to me


Happy New Year!
http://i45.tinypic.com/1nyasi.pnghttp://i50.tinypic.com/219pez8.pnghttp://i49.tinypic.com/e5s4zr.pnghttp://i48.tinypic.com/23l18hf.jpghttp://i49.tinypic.com/66zymu.png

Offline

 

#6 2009-05-06 09:17:46

Zolareelo
Scratcher
Registered: 2009-05-05
Posts: 6

Re: "If" Conditional Troubleshooting

Here's the script (Pardon the format):

When Green Flag Clicked
Forever
   If: Playerturn=1 AND NOT: AI=1 AND Touching Mouse Pointer AND Mouse Down
      Set Beadmove to 5
      Broadcast: Un#ball
      Forever                      __
         Change P4 by 1           | 
         Change P5 by -1          |
         If P5=0                        |-This peice of code is repeated 13 more times
            Broadcast: Move      |   in the script with minor alterations.
            Stop Script          __|

Thats more or less the problem area. This particular script is copied 23 more times in the coding.

Last edited by Zolareelo (2009-05-06 09:18:55)

Offline

 

#7 2009-05-06 09:21:27

Zolareelo
Scratcher
Registered: 2009-05-05
Posts: 6

Re: "If" Conditional Troubleshooting

Paddle2See wrote:

Of course, if you fire off another script with a Broadcast block, you can run into sequence problems.  If that is the case, try using the Broadcast and Wait block.

Hmm... that might be it, though it will be incrediably tedious to fix, what with 336 broadcast blocks floatin around in the code that i'm having problems with...

Doublepost!

Last edited by Zolareelo (2009-05-06 09:21:47)

Offline

 

Board footer