From Test-Scratch-Wiki

当收到讯息 ()
2.0 When I Receive ().png
Category 事件类积木
Type 半圆形积木

The When I Receive () 积木 is an 事件类积木 and a 半圆形积木. 程式 that begin with this block will be invoked once the specified 广播 has been sent by a calling script.

If a 重复无限次 block is sending the broadcast faster than the attached script can finish running, the script will restart without reaching the blocks at the end. This can be avoided by using 广播 () 并等待.


广播 are used to invoke scripts when certain evaluations are met; for scripts to activate once the broadcast is sent, those scripts must wear the When I Receive () block. Some common uses are:

  • Preparing a change in the 专案
當收到訊息 [Failure v]
等待 (3) 秒
效果 [顏色 v] 改變 (25)
stop all
  • Hiding select sprites when a certain condition is met under a particular evaluation
當收到訊息 [broadcast v]
  • When a scene must be set
當收到訊息 [next background v]
  • Effective communication with scripts or 角色
當 @greenflag 被點擊
說出 [Hi!] (1) 秒
廣播訊息 [communicate v]
當收到訊息 [communicate v]
說出 [Hi!] (1) 秒
當收到訊息 [run v]
. . .
廣播訊息 [run v]
  • Winning a game
當收到訊息 [win v]
說出 [You win!] (2) 秒


Cookies help us deliver our services. By using our services, you agree to our use of cookies.