say ()

From PenguinMod Wiki (Official)
Say ()
Jump to navigation Jump to search

The say () block is a stack block that makes the sprite say the specific text in a speech bubble. It is in the Looks category, and originates from Scratch. The default text is "Hello!". The sprite will stop speaking if a blank value is entered, when the stop speaking block is used, or when the stop sign is pressed.

It can be used alongside the speak [] block to have dialogue with speech at the same time, which can be used for accessibility.

define say text (string1)
say (string1)
speak (string1)
when gf clicked
say text [Hello!] //the custom block would be used like this, and in this script, the text "Hello!" would be both said and spoken.

This can be used for dialogue:

when I receive [speak v]
say [D'oh!] for (2) seconds

It can also be used for "typing" engines, which types out what is being said:

define type (text)
set [letter number] to [0]::#0869c2 //keep track of the current text
set [current text] to []::#0869c2 //the input is blank
repeat (length of (text))
change [letter number] by (1)::#0869c2 //this will go through every letter number
set [current text] to (join (get [current text]::#0869c2) (letter (get [letter number]::#0869c2) of (text)))::#0869c2
say (get [current text]::#0869c2)
wait (0) seconds
end
say (text) for (2) seconds
when I receive [start v]
type [Hello there!]
type [Welcome to the world of Pokémon!]

The length of () block can also be used to remove the need to use a "letter number" variable, and normal variables can also be used.

Gallery

Trivia

See also

References