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

#1 2012-10-09 21:35:34

turkey3
Scratcher
Registered: 2011-12-04
Posts: 500+

Was my script just too long?

I was making a project and I had a pretty long script of if statements (it's a drawing project)

if <(tool) = [paint brush]>
scripts
End
Etc.
Eventually in one of my if statements the statement was true. But the script didn't work!  I even picked out the booleans and it was all true. So I took that if statement out of the script and clicked on it. Then it worked. But when I put it back with the long script it didn't work.
   I was just wondering why this would be. Anyway, I just used a broadcast to continue and split the script.

Last edited by turkey3 (2012-10-09 21:35:53)

Offline

 

#2 2012-10-09 22:11:53

Mokat
Scratcher
Registered: 2011-12-08
Posts: 1000+

Re: Was my script just too long?

There were probably too many if blocks to report true. If you had a lot of ifs iinside each other this may be the issue.

And whoa. I haven't seen you around for a long time!!


http://www.eggcave.com/egg/977371.pnghttp://www.eggcave.com/egg/977376.pnghttp://www.eggcave.com/egg/1005291.pnghttp://www.eggcave.com/egg/996745.png

Offline

 

#3 2012-10-10 02:41:36

Gravitation
New Scratcher
Registered: 2012-09-26
Posts: 500+

Re: Was my script just too long?

It's a good idea to use if/elses instead, like so:

if <(tool) = [paint brush]>
 scripts
else
 if <(tool) = [pencil]>
  scripts
 else
  etc.
 end
end
and for the last one, just add the scripts into the else.  smile

Offline

 

#4 2012-10-10 08:12:21

Mokat
Scratcher
Registered: 2011-12-08
Posts: 1000+

Re: Was my script just too long?

Gravitation wrote:

It's a good idea to use if/elses instead, like so:

if <(tool) = [paint brush]>
 scripts
else
 if <(tool) = [pencil]>
  scripts
 else
  etc.
 end
end
and for the last one, just add the scripts into the else.  smile

^this. If you do this:

if <[483]=(variable)> 
scripts
end
if <not <[483]=(variable)>
scripts
end
It might confuse the program. Try using the script Gravitation mentioned.


http://www.eggcave.com/egg/977371.pnghttp://www.eggcave.com/egg/977376.pnghttp://www.eggcave.com/egg/1005291.pnghttp://www.eggcave.com/egg/996745.png

Offline

 

Board footer