(Redirected from Broadcast () and Wait)

Broadcast () and Wait
broadcast [message1 v] and wait
Category Event
Type Stack

The Broadcast () and Wait block is an Event block and a Stack block. The block sends a broadcast throughout the whole Scratch project. Any scripts that start with the When I Receive () block and are set to the matching broadcast will activate. This broadcast waits until all scripts activated by the broadcast end and stop running. Broadcasts are a good way to have sprites and scripts communicate.

Example Uses

If a script must be activated without a user prompt and after the project has started, there is only one way: broadcasts. Some common uses:

When I receive [Sprite1 Talk v]
say [Hi, Gobo!] for (2) secs
broadcast [Sprite2 Talk v] and wait
say [Let's talk about food.] for (2) secs
  • Ordinary animations
glide (1) secs to x: (-148) y: (80)
play sound [meow v]
broadcast [move v] and wait
  • Waiting for an online data decoding before starting
when gf clicked
broadcast [decodeCloudData v] and wait
ask [enter your password to resume your progress!] and wait
set [i v] to [1]
repeat until <(item (i) of [users v]) = (username)>
change [i v] by (1)
decrypt password ::custom
if <(answer) = (properPassword)> then
broadcast [playGame v]
broadcast [cannotPlay v]
set [chat v] to [1]
broadcast [P2 chat v] and wait


Main article: Recursion

Broadcast blocks can also, in a way, induce recursion. Recursion happens when a block (or broadcast script in this article) calls on itself at some point in the code. It can be used to create fractals, create a forever loop, etc.

See Also