I never really got what they do or why it was made to be put in the scratch program. I know what broadcast does, but not the broadcast and wait.
Offline
jontmy00 wrote:
It broadcasts a message, then waits until the receiving script finishes.
Then why was it made when it can easily be worked around like this:
when gf clicked forever broadcast [blah v] set [var v] to [0] wait until <(var)=[1]> set [broadcast and wait v] to [workedarounded]
when I receive [blah v] wait (1) secs set [var v] to [1]
Last edited by TorbyFork234 (2012-05-13 02:33:02)
Offline
TorbyFork234 wrote:
jontmy00 wrote:
It broadcasts a message, then waits until the receiving script finishes.
Then why was it made when it can easily be worked around like this:
when gf clicked forever broadcast [blah v] set [var v] to [0] wait until <(var)=[1]> set [broadcast and wait v] to [workedarounded]when I receive [blah v] wait (1) secs set [var v] to [1]
Because that requires a variable and a bunch of extra blocks. Broadcast and wait has a good number of uses, so it makes sense to make it its own block.
Offline
TorbyFork234 wrote:
jontmy00 wrote:
It broadcasts a message, then waits until the receiving script finishes.
Then why was it made when it can easily be worked around like this:
when gf clicked forever broadcast [blah v] set [var v] to [0] wait until <(var)=[1]> set [broadcast and wait v] to [workedarounded]when I receive [blah v] wait (1) secs set [var v] to [1]
Why was go to included? Change by? Forever? They can be worked around, but it's not easy.
Offline
For one thing, if several sprites receive the broadcast and perhaps each react slightly differently, it will wait until they're all done. You could still do that without it of course, but setting it up would be alot of work.
I suspect another reason is that broadcast and wait is the closest thing Scratch currently has to functions or subroutines in most programing languages.
Offline
In my most recent game, "Minecraft* (for Scratch)", I have some scripts that I wish to function as if the blocks were in the main script, but I want to be able to call it again and again without duplicating the script. However because the sub-script takes a few seconds to execute, broadcast and wait prevents the two scripts from interfering.
when gf clicked broadcast [subscript v] and wait broadcast [subscript v] and wait*Yes Mojang, that is breaking the MINECRAFT NAME, BRAND AND ASSETS USAGE GUIDELINES. If you care, contact me
Offline