Not to be confused with Say () for () Seconds (block) or Speak () (block).
Say ()
say ()
Category Looks
Type Stack
Introduced in 13Oct04

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 () Seconds block. This mechanism is similar to the Start Sound () block.

Example Uses

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

As this block gives an optionally everlasting speech bubble (see 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 uses are:

  • An object always making a sound
say [Buzz... Buzz...]
  • A 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 π (pi)?] and wait
say [3.141592653589793238462643383279502884197169399375105...]
wait (answer) seconds
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 []

Character Limit

A character limit was added for Scratch 3.0, limiting all text to 330 characters or less.[1] This limitation also applies to the following blocks:

  • say () for () seconds
  • think ()
  • think () for () seconds

Common Mistake

The "say" block is often misunderstood 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.[2]

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 []

A proper script would look like this:

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

This script waits for 2 seconds before taking further action, making it possible for the user to see the dialogue.

Debugging

The say block can be useful for debugging 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

References

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