From Test-Scratch-Wiki

Say ()
2.0 Say ().png
Category Looks
Type Stack

The Say () block is a Looks block and a Stack block. The block gives its sprite a speech bubble with the specified text

— the speech bubble stays until an another speech or thought block is activated, or the stop sign is pressed. This block is identical to the Think () block, except that this block gives a speech bubble, while the other gives a thought bubble. This block immediately moves on to the next block when it is activated, unlike the say () for () secs block.

Example Uses

The Scratch Cat saying "Hello!" with the Say block

As this block gives an optionally everlasting speech bubble (see [[Eng:#Common Mistake|common mistake]] for how to stop the speech), it is often used for a speech bubble that is desired to end after an unspecified amount of time, such as a triggered event or statement.

Some common uses are:

  • An object always making a sound
say [Buzz... Bzz...]
  • A sort of picture or a sign
say [<-- Dragon  {}  Bank -->]
  • A message that is not wanted to go away
say [I am the forever sign. Age has worn my wood so much...]
  • A message that flips to the next when the space key is pressed
when gf clicked
say [Do you want to know the answer to life the universe and everything? (Press Space)]
wait until <key [space v] pressed?>
say [42]
  • An ending message (for example, 'You win!' or 'Please comment your thoughts!')
when gf clicked
wait until <(score) > (9)>
say [Great job! You win with a score of 10!]
  • A message that the viewer can choose how long it stays for
when gf clicked
ask [How long would you like me to say π?] and wait
say [3.14159265358979323846264338327950288...]
wait (answer) secs
say []
  • Variable length speech (such as waiting for a player's action before moving on)
when gf clicked
say [Press space to continue!]
wait until <key [space v] pressed?>
broadcast [continue v]
say []

Common Mistake

The "say" block is often mistaken to stop saying the message when the script ends or moves on to the next block, but instead, the sprite continuously says the text until it says or thinks something else. To make a sprite stop saying a message, it must speak a blank message, which triggers the speech bubble to stay hidden and the sprite to say nothing.

Note Note: Starting and stopping a project causes the sprites to stop saying all messages.

The following script is an example of making a sprite say a message for an unspecified amount of time, and then stopping the message.

when gf clicked
say [Watch me spin!]
repeat (pick random (90) to (110))
turn right (4) degrees
end
say []

Debugging

The say block can be useful for projects, as it can monitor certain values that the user needs to know about, by putting it in a forever loop. For example:

forever
say ((var1) + ((var2) * (var3)))
end

See Also

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