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:39:25

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 09:46:59

esanteva
Scratcher
Registered: 2009-05-05
Posts: 4

Re: "if" Conditional Troubleshooting

I don't think Scratch is supposed to go ahead running the portion of a script AFTER the if conditionals while the condition is evaluated. Would you mind sharing the project and posting a link?

Offline

 

#3 2009-05-05 09:50:43

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

Re: "if" Conditional Troubleshooting

I have shared it but I cannot post more right now, since class has ended.

Last edited by Zolareelo (2009-05-07 09:21:55)

Offline

 

#4 2009-05-05 15:54:23

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

Re: "if" Conditional Troubleshooting

Try breaking it up into many scripts, so that everything will happen at the same time almost, and it will run faster


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

 

#5 2009-05-06 09:44:52

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.

Offline

 

#6 2009-05-08 04:05:08

pokemon_master12
Scratcher
Registered: 2008-09-26
Posts: 100+

Re: "if" Conditional Troubleshooting

I think that having that many scripts will make the project size too big. You're only allowed to share 10 MB worth of any project. A much easier way to make this game instead of having all those "if" blocks is this: use broadcasting. If you don't know how to use broadcasting, look for tutorial projects on the site, look at the Scratch block descriptions online and offline in the Scratch program itself. Boradcasting will send a message to all the sprites, and then you can just put one simple script like this in every stone:

[blocks]<when I receive[ broadcast message name goes here[/blocks]
Do whatever you want the stones to do

So that's it! Now you will have MUCH more space! I hope that helped you! Happy Scratch-ing!  smile


My Dragon Egg! http://dragcave.net/image/5YUA.gif
Visit my blog: http://freyasworld.wordpress.com/

Offline

 

Board footer