DialogueText

┗> Text > Object > Class


The DialogueText object displays text letter-by-letter.


Constructor


DialogueText(text: string|string[], x: number, y: number, w: number?, h: number?, options: TextSettings?)

@param text — The text to display. Can be a string, or an array of strings for sequential lines.

@param x — The X position of the text.

@param y — The Y position of the text.

@param w — The width of the text box. Defaults to the screen size if not specified.

@param h — The height of the text box. Defaults to the screen size if not specified.

@param options — The text's settings.

Arguments:

text: string|string[]

The text to display. Can be a string, or an array of strings for sequential lines.

x: number

The X position of the text.

y: number

The Y position of the text.

w: number?

The width of the text box. Defaults to the screen size if not specified.

h: number?

The height of the text box. Defaults to the screen size if not specified.

options: TextSettings?

The text's settings.





Methods


DialogueText:addFunction(id: any, func: any)

Arguments:

id: any
func: any


DialogueText:advance()

Advances the text to the next line, if there is one. Otherwise, marks the text as done and calls the advance callback if there is one. If the text is already done, does nothing.







DialogueText:isDone()

Whether or not the text is done. The text must be advanced past the last line for it to be considered done.

For whether the text is currently displaying all of its characters, see DialogueText:isTyping().

Returns:

Whether: boolean

the text has finished displaying all lines.



DialogueText:isModifier(command: any)

Arguments:

command: any

Returns:

1: true


DialogueText:isNodeInstant(node: any)

Arguments:

node: any

Returns:

1: boolean


DialogueText:isTyping()

Whether or not the text is currently typing out characters letter-by-letter for the current line.

Returns:

is_typing: boolean

Whether the text is currently typing out characters letter-by-letter for the current line.



DialogueText:playTextSound(current_node: any)

Arguments:

current_node: any


DialogueText:processCustomCommand(node: any, dry: any)

Arguments:

node: any
dry: any

Returns:

1: unknown




DialogueText:processModifier(node: any, dry: any)

Arguments:

node: any
dry: any


DialogueText:registerCommand(command: any, func: any, options: any)

Arguments:

command: any
func: any
options: any




DialogueText:setText(text: string|string[], advance_callback: fun()?, line_callback: fun( integer)?)

@param text — The text to display. Can be a string, or an array of strings for sequential lines.

@param advance_callback — A function to call when the text is advanced (Either by player inpute, or by auto-advance) at the end of the text.

@param line_callback — A function to call when a new line is set.

Arguments:

text: string|string[]

The text to display. Can be a string, or an array of strings for sequential lines.

advance_callback: fun()?

A function to call when the text is advanced (Either by player inpute, or by auto-advance) at the end of the text.

line_callback: fun( integer)?

A function to call when a new line is set.





DialogueText:updateTalkSprite(typing: any)

Arguments:

typing: any



Fields


DialogueText.actor: Actor?

Actors are a type of data class that represent the visuals of a character - anything that is some type of character, be it the player, an NPC, or an enemy in battle, it will require an actor.
As a data class, actors are stored in scripts/data/actors/, and extend this class. Their filepath starting from here becomes their id, unless an id is specified as an argument to Class().




Undocumented



DialogueText.COMMANDS: table

The list of built-in modifiers that DialogueText supports, in addition to the standard Text commands, and any custom ones.











DialogueText.canvas: love.Canvas

A Canvas is used for off-screen rendering. Think of it as an invisible screen that you can draw to, but that will not be visible until you draw it to the actual visible screen. It is also known as "render to texture".

By drawing things that do not change position often (such as background items) to the Canvas, and then drawing the entire Canvas instead of each item, you can reduce the number of draw operations performed each frame.

In versions prior to love.graphics.isSupported("canvas") could be used to check for support at runtime.

Open in Browser