Skip to content

Dialogue Box

A dialogue box: lines with a speaker type out and advance with the confirm action. Scripts: box:dialogue_show({…}); events line_shown / finished.

Type: DialogueNode · Category: UI & Interface · Also found as: dialogue, dialoguebox

Property Type Default Description
size vec2 (900, 170) Width and height (px). Range 4 to 1280.
font string "" Project font (“” = the engine font).
fontSize number 24 Text size (px). Range 8 to 96.
textColor color #eef0f6ff Colour of the line’s text.
speakerColor color #facc15ff Colour of the speaker’s name.
panelColor color #0f121ce6 Fill colour of the box.
borderColor color #5c8dffff Colour of the box’s border.
padding number 20 Space between the border and the text (px). Range 0 to 100.
revealSpeed number 40 Typewriter speed in characters per second (0 = whole lines). Range 0 to 500.
advanceAction string "confirm" Input action that shows the rest of the line, then the next (“confirm”).
localized boolean false Lines are keys in the locale tables (locale/*.csv).
mode enum: Box, Subtitles Box Box: a dialogue box the player advances. Subtitles: the lines go on the subtitle track (no box), each for its voice’s length or reading time, then the next by itself - cutscenes, barks.

Plus the common properties every node has.

Call them on the node (self.node in its script, or self.node:get_node("path")). Every node also has the Node methods.

Connects a handler to one of this node’s events: line_shown (A dialogue line was fully shown (1-based)), finished (Playback (or the dialogue) ended); the tree events; custom ones.

self.node:connect("line_shown", function(value, source) Log.info("line_shown") end)
  • event DialogueNodeEvent|string
  • handler fun(value: any, source: DialogueNode)

Returns integer id Connection id for disconnect

Reads an Inspector property by its path (vectors and colours as tables); “script.” reads a field of the node’s script.

local value = self.node:get_property("size")
  • path DialogueNodeProperty|string

Returns any

Sets an Inspector property by its path: vectors as {x, y} or x, y; colours as {r, g, b[, a]} 0..1 or “#rrggbb[aa]”; enums by name; “script.” a field of the node’s script.

self.node:set_property("size", 100, 50)
  • path DialogueNodeProperty|string
  • value any
  • y? number

DialogueNode:dialogue_show(lines, speaker)

Section titled “DialogueNode:dialogue_show(lines, speaker)”

DialogueNode: opens the box with these lines (strings or {speaker, text}), or one line: box:dialogue_show(text, speaker). Each line types out; the advance action (default “confirm”) shows the rest, then the next line. Events: “line_shown”(index), “finished”.

local box = Scene.find_node("Dialogue"); box:dialogue_show({ { speaker = "Guard", text = "Halt!" } })
  • lines string|(string|DialogueLine)[]
  • speaker? string

Shows the rest of the line, else the next one.

Scene.find_node("Dialogue"):dialogue_next()

Closes the dialogue box.

Scene.find_node("Dialogue"):dialogue_close()

Checks whether the dialogue box is currently open.

if Scene.find_node("Dialogue"):dialogue_is_open() then return end

Returns boolean

{
"type": "DialogueNode",
"name": "DialogueBox",
"position": [
0,
0
],
"properties": {
"size": [
900,
170
],
"font": "",
"fontSize": 24
}
}