From Test-Scratch-Wiki

The general shape of a Hat block.
A Hat Block, also called an Event Block, is a 积木 that is designed to start a 程式. This makes them essential for making 专案. All the 帽子式积木 are either 控制类积木 or 事件类积木. In the 实验查看器, the first word of their name is capitalised.

帽子式积木 are useful in 事件驱动程式设计 .


As 帽子式积木 are designed to start a script, they are shaped so no blocks can go on top of them — this is done by rounding the blocks' top. The bottom of 帽子式积木 are the same as 堆叠式积木.

点击绿旗时 // 这就是帽子式积木.
定位到 [鼠标 v] 位置


There are eleven 帽子式积木 in Scratch. Four are used for extensions. They are:

A wanted hat block is When () Is True.[1] It is available in some Scratch Modifications. This block can be reproduced by doing the following:

當 @greenflag 被點擊
  等待直到 <condition>
  廣播訊息 [true v]
  等待直到 <<condition> 不成立>
當收到訊息 [true v]
. . .


Without 帽子式积木, scripts could only be activated manually, and not at all online. Each Hat block has a different method for getting activated — this is so different scripts can be started at different times. There are four different ways to activate a script — when the 绿旗 is clicked, a key is pressed, the 角色 is clicked, or when a broadcast is received.

An example for when the When I Receive () block can be used as follows:

當收到訊息 [Next Level v]

Snap! Hat 积木相关

In the Scratch Modification Snap!, 帽子式积木 are used in definitions of Custom Blocks (procedures). These 帽子式积木 contain an image of the block on them. The custom block carries out the script attached to the bottom of the hat block.

帽子式积木 cannot be created in BYOB 3.1, but may be available in BYOB/Snap! 4.0.