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

#1 2012-11-15 14:19:33

clubby789
New Scratcher
Registered: 2012-11-15
Posts: 17

script help!

I made a children in need game, but its very buggy! Called CIN! Let me know how to fix! :¬P

Offline

 

#2 2012-11-15 15:08:45

joefarebrother
Scratcher
Registered: 2011-04-08
Posts: 1000+

Re: script help!

You haven't explained your problem so how do you expect us to help? Have you got it online? is there a link?


My latest project is called http://tinyurl.com/d2m8hne! It has http://tinyurl.com/d395ygk views, http://tinyurl.com/cnasmt7 love-its, and http://tinyurl.com/bwjy8xs comments.
http://tinyurl.com/756anbk   http://tinyurl.com/iplaychess

Offline

 

#3 2012-11-16 12:02:42

clubby789
New Scratcher
Registered: 2012-11-15
Posts: 17

Re: script help!

http://scratch.mit.edu/projects/clubby789/2910966

Offline

 

#4 2012-11-16 12:08:51

clubby789
New Scratcher
Registered: 2012-11-15
Posts: 17

Re: script help!

Well, pudsey is collecting for children in need, and when you have got all the money, an object says 'Well done', then should say 'You scored...'. But I told it to say 'Well done' for one second, but it just carries on!

Offline

 

#5 2012-11-16 13:22:50

Llamalover
Scratcher
Registered: 2007-05-18
Posts: 100+

Re: script help!

Hi!
Firstly, instead of your 'forever if:' code for each of the houses, you'd do better to use:


when gf clicked

forever  

if <touching [Sprite1 v]?> 

change [Money v] by (House3)

set [House3 v] to [0]

change [Collected v] by (-1)

stop script

end

end

or

when gf clicked

wait until <touching [Sprite1 v]?>

change [Money v] by (House2)

set [House2 v] to [0]

change [Collected v] by (-1)

You can use a 'wait until' block, because the action only happens once. The 'forever if' block will keep repeating whatever code it contains when the condition is fulfilled. The forever THEN if blocks keeps checking whether the condition is fulfilled, then executes the script it contains. The 'wait until' block is pretty self-explanatory.

As for the broadcast problem, this is because a. you used a 'forever if' block, which will keep repeating itself, and b. you used a 'broadcast X' block instead of a 'broadcast X and wait' .
This means that as soon as Collected hit 0, the broadcast 'Collected' was being continuously sent out - the script didn't have time to finish and had to keep restarting.
If you only want the message to be displayed once, just use a 'wait until'. Otherwise, you could use a forever if, or:

when gf clicked

forever  

if <touching [Sprite1 v]?> 

change [Money v] by (House3)

set [House3 v] to [0]

change [Collected v] by (-1)

stop script

end

end

Good luck, and don't forget to add instructions on how to play in the project notes  smile


Be nice, I'm an old lady  wink

Offline

 

#6 2012-11-16 14:00:01

clubby789
New Scratcher
Registered: 2012-11-15
Posts: 17

Re: script help!

Thanks!

Offline

 

#7 2012-11-17 05:22:36

clubby789
New Scratcher
Registered: 2012-11-15
Posts: 17

Re: script help!

It's all fixed!

Offline

 

Board footer