I need a script where an object keeps on doing something until he receives a broadcast. Is there any way to do that?
Offline
Bookworm300 wrote:
I need a script where an object keeps on doing something until he receives a broadcast. Is there any way to do that?
Depends...if when he receives it, everything stops, then you just need a script that stops all.
Besides that, you'll probably have to use a variable that gets set to a value when that event that would broadcast happens.
Offline
Well, what you would want is the fictional
block.
Click on the image for a workaround which you can use.
Offline
Or something like this:
<when I receive[ something ]>
<set{ continue? }to( 1 )
<repeat until><( <{ continue? }> <=> 0 )>
Script
<end>
Then, to stop it, just set "continue?" to 0 instead of broadcasting "StopScript".
Last edited by MoreGamesNow (2011-10-11 07:33:40)
Offline
I've had the same trouble as you and figured out how to fix it. instead of using a broadcast, use a variable
<when green flag clicked>
<forever>
<repeat until><(<{ name of variable }><=>1
<move( 10 )steps>
<end>
<end>
and instead of telling it to broadcast now you need to tell it to always set your variable to 0 except when you want it to stop doing something
Last edited by rojasscratches (2011-10-11 09:57:00)
Offline