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
Properties
Section titled “Properties”| 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.
Lua methods
Section titled “Lua methods”Call them on the node (self.node in its script, or self.node:get_node("path")). Every node also has the Node methods.
DialogueNode:connect(event, handler)
Section titled “DialogueNode:connect(event, handler)”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)eventDialogueNodeEvent|stringhandlerfun(value:any, source: DialogueNode)
Returns integer id Connection id for disconnect
DialogueNode:get_property(path)
Section titled “DialogueNode:get_property(path)”Reads an Inspector property by its path (vectors and colours as tables); “script.
local value = self.node:get_property("size")pathDialogueNodeProperty|string
Returns any
DialogueNode:set_property(path, value, y)
Section titled “DialogueNode:set_property(path, value, y)”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.
self.node:set_property("size", 100, 50)pathDialogueNodeProperty|stringvalueanyy?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!" } })linesstring|(string|DialogueLine)[]speaker?string
DialogueNode:dialogue_next()
Section titled “DialogueNode:dialogue_next()”Shows the rest of the line, else the next one.
Scene.find_node("Dialogue"):dialogue_next()DialogueNode:dialogue_close()
Section titled “DialogueNode:dialogue_close()”Closes the dialogue box.
Scene.find_node("Dialogue"):dialogue_close()DialogueNode:dialogue_is_open()
Section titled “DialogueNode:dialogue_is_open()”Checks whether the dialogue box is currently open.
if Scene.find_node("Dialogue"):dialogue_is_open() then return endReturns boolean
In a scene file
Section titled “In a scene file”{ "type": "DialogueNode", "name": "DialogueBox", "position": [ 0, 0 ], "properties": { "size": [ 900, 170 ], "font": "", "fontSize": 24 }}