Dev » Lua API » dialoguestep
← Back to all classes

dialoguestep

Dialogue 15 Properties 36 Methods

dialoguestep

The dialoguestep class represents a single step or decision node in a dialogue sequence. Supports interactive player choices (options), branch conditions, media, and transitions.

Overview

Properties (15)

Property Type Summary
entities table Table of associated entities.
entity entity The speaking entity associated with this step.
extraPosition vector3 3D camera pan position.
falseNext number Target step index when condition evaluates false.
hasOptions boolean Checks if step has choice options.
media string Sound or music resource path.
next number Target step index for primary connection.
optionCount number Number of choice options on step.
position vector2 Graph editor 2D position.
script string Lua script executed on step activation.
text string The text line or script content.
title string Title or label of the step.
trueNext number Target step index when condition evaluates true.
type number The step type ID (see dialoguesteptype).
typeName string The step type name string.

Methods (36)

Method Signature Returns Summary
dialoguestep:addBranch(valueOrWeight, [target], [action]) dialoguestep Adds a branch for switch or random step.
dialoguestep:addEntity(entityVal) dialoguestep Adds an entity to the step.
dialoguestep:addOption(arg1, [arg2], [arg3], [arg4]) dialoguestep Adds an interactive choice option button.
dialoguestep:clearOptions() dialoguestep Clears all choice options from this step.
dialoguestep:clone() dialoguestep Creates a deep copy of this dialogue step.
dialoguestep:connect(nextVal) dialoguestep Connects primary exit connection to next step.
dialoguestep:connectFalse(nextVal) dialoguestep Connects FALSE condition exit connection.
dialoguestep:connectTrue(nextVal) dialoguestep Connects TRUE condition exit connection.
dialoguestep.createCamera(target) dialoguestep Static factory for camera pan step.
dialoguestep.createCondition(script, [trueTarget], [falseTarget]) dialoguestep Static factory for condition step.
dialoguestep.createDelay(seconds) dialoguestep Static factory for timed delay step.
dialoguestep.createEntity(entity, text) dialoguestep Static factory for NPC dialogue step.
dialoguestep.createMusic(media) dialoguestep Static factory for music step.
dialoguestep.createNarrative(text) dialoguestep Static factory for narrative text step.
dialoguestep.createPlayer(text) dialoguestep Static factory for player dialogue step.
dialoguestep.createRadio(entity, text) dialoguestep Static factory for radio dialogue step.
dialoguestep.createRandom() dialoguestep Static factory for random branch step.
dialoguestep.createSwitch(script) dialoguestep Static factory for switch step.
dialoguestep:getOption(index) table Gets data for a choice option.
dialoguestep:getOptions() table Gets all choice options.
dialoguestep.new([type], [text], [entity]) dialoguestep Constructs a new dialogue step.
dialoguestep:removeOption(index) boolean Removes a choice option by index.
dialoguestep:setEntities(entitiesVal) dialoguestep Sets associated entities.
dialoguestep:setEntity(entityVal) dialoguestep Sets speaking entity.
dialoguestep:setExtraPosition(arg1, [y], [z]) dialoguestep Sets 3D extra camera position.
dialoguestep:setMedia(media) dialoguestep Sets media resource path.
dialoguestep:setOptionAction(index, action) boolean Sets the Lua callback function executed when option is clicked.
dialoguestep:setOptionCondition(index, conditionScript) boolean Sets the display condition script for an option.
dialoguestep:setOptionNext(index, target) boolean Updates the destination step of an option.
dialoguestep:setOptionText(index, text) boolean Updates the label text of an option.
dialoguestep:setPosition(arg1, [y]) dialoguestep Sets 2D graph editor position.
dialoguestep:setScript(script) dialoguestep Sets activation script.
dialoguestep:setText(text) dialoguestep Sets dialogue text line.
dialoguestep:setTitle(title) dialoguestep Sets step title.
dialoguestep:setType(typeVal) dialoguestep Sets step type.
dialoguestep:show() void Displays this step immediately in the dialogue UI.

Detailed Reference

# entities PROPERTY
dialoguestep.entities
Table of associated entities.
Parameters
None
Returns
table

Array of associated entities.

Description

Gets or sets array of associated entities.

# entity PROPERTY
dialoguestep.entity
The speaking entity associated with this step.
Parameters
None
Returns
entity

Speaking entity or nil.

Description

Gets or sets the speaking entity.

# extraPosition PROPERTY
dialoguestep.extraPosition
3D camera pan position.
Parameters
None
Returns
vector3

3D camera pan position.

Description

Target coordinates for camera panning.

# falseNext PROPERTY
dialoguestep.falseNext
Target step index when condition evaluates false.
Parameters
None
Returns
number

False branch step index.

Description

Target step when condition fails.

# hasOptions PROPERTY
dialoguestep.hasOptions
Checks if step has choice options.
Parameters
None
Returns
boolean

True if options exist.

Description

Returns true if interactive choices are configured.

# media PROPERTY
dialoguestep.media
Sound or music resource path.
Parameters
None
Returns
string

Media resource path.

Description

Gets or sets audio media path.

# optionCount PROPERTY
dialoguestep.optionCount
Number of choice options on step.
Parameters
None
Returns
number

Option count.

Description

Returns count of choices.

# position PROPERTY
dialoguestep.position
Graph editor 2D position.
Parameters
None
Returns
vector2

Graph position.

Description

Position in node graph editor.

# script PROPERTY
dialoguestep.script
Lua script executed on step activation.
Parameters
None
Returns
string

Script string.

Description

Gets or sets trigger script.

# text PROPERTY
dialoguestep.text
The text line or script content.
Parameters
None
Returns
string

Dialogue text line.

Description

Gets or sets the dialogue speech text or script string.

# title PROPERTY
dialoguestep.title
Title or label of the step.
Parameters
None
Returns
string

Step title.

Description

Gets or sets step title.

# trueNext PROPERTY
dialoguestep.trueNext
Target step index when condition evaluates true.
Parameters
None
Returns
number

True branch step index.

Description

Target step when condition passes.

# type PROPERTY
dialoguestep.type
The step type ID (see dialoguesteptype).
Parameters
None
Returns
number

Dialogue step type integer ID.

Description

Gets or sets the step type.

# typeName PROPERTY
dialoguestep.typeName
The step type name string.
Parameters
None
Returns
string

Step type name string.

Description

Returns step type name (e.g. "NarrativeText", "EntityDialogue", "Condition").

# addBranch METHOD
dialoguestep:addBranch(valueOrWeight, [target], [action])
Adds a branch for switch or random step.
Parameters
ParameterTypeDefaultDescription
valueOrWeightstring|number

Value key or random weight.

targetdialoguestep|numberoptional

Destination step.

actionfunctionoptional

Callback.

Returns
dialoguestep

Self.

Description

Appends a case or weight branch.

# addEntity METHOD
dialoguestep:addEntity(entityVal)
Adds an entity to the step.
Parameters
ParameterTypeDefaultDescription
entityValentity|number

Entity to add.

Returns
dialoguestep

Self.

Description

Appends entity to step entities.

# addOption METHOD
dialoguestep:addOption(arg1, [arg2], [arg3], [arg4])
Adds an interactive choice option button.
Parameters
ParameterTypeDefaultDescription
arg1string|table

Option text or table with {text, next, action, condition}.

arg2dialoguestep|number|function|stringoptional

Next step, action callback, or condition script.

arg3dialoguestep|number|function|stringoptional

Additional option parameter.

arg4dialoguestep|number|function|stringoptional

Additional option parameter.

Returns
dialoguestep

Self.

Description

Adds a player response button to this dialogue step.

step:addOption("Sure, I can help!", nextStep, function()
    print("Player agreed to quest!")
end)
# clearOptions METHOD
dialoguestep:clearOptions()
Clears all choice options from this step.
Parameters
None
Returns
dialoguestep

Self.

Description

Removes all options.

# clone METHOD
dialoguestep:clone()
Creates a deep copy of this dialogue step.
Parameters
None
Returns
dialoguestep

Cloned step.

Description

Duplicates the step.

# connect METHOD
dialoguestep:connect(nextVal)
Connects primary exit connection to next step.
Parameters
ParameterTypeDefaultDescription
nextValdialoguestep|number|nil

Destination step.

Returns
dialoguestep

Self.

Description

Wires transition to nextVal.

# connectFalse METHOD
dialoguestep:connectFalse(nextVal)
Connects FALSE condition exit connection.
Parameters
ParameterTypeDefaultDescription
nextValdialoguestep|number|nil

Destination step if false.

Returns
dialoguestep

Self.

Description

Wires false branch to nextVal.

# connectTrue METHOD
dialoguestep:connectTrue(nextVal)
Connects TRUE condition exit connection.
Parameters
ParameterTypeDefaultDescription
nextValdialoguestep|number|nil

Destination step if true.

Returns
dialoguestep

Self.

Description

Wires true branch to nextVal.

# createCamera METHOD
dialoguestep.createCamera(target)
Static factory for camera pan step.
Parameters
ParameterTypeDefaultDescription
targetentity|vector3

Camera target.

Returns
dialoguestep

Created step.

Description

Creates a camera panning step.

# createCondition METHOD
dialoguestep.createCondition(script, [trueTarget], [falseTarget])
Static factory for condition step.
Parameters
ParameterTypeDefaultDescription
scriptstring

Condition script.

trueTargetdialoguestep|numberoptional

True branch.

falseTargetdialoguestep|numberoptional

False branch.

Returns
dialoguestep

Created step.

Description

Creates a conditional branch step.

# createDelay METHOD
dialoguestep.createDelay(seconds)
Static factory for timed delay step.
Parameters
ParameterTypeDefaultDescription
secondsnumber

Seconds to wait.

Returns
dialoguestep

Created step.

Description

Creates a pause step.

# createEntity METHOD
dialoguestep.createEntity(entity, text)
Static factory for NPC dialogue step.
Parameters
ParameterTypeDefaultDescription
entityentity|number

Speaking NPC.

textstring

NPC speech line.

Returns
dialoguestep

Created step.

Description

Creates an NPC speech step.

# createMusic METHOD
dialoguestep.createMusic(media)
Static factory for music step.
Parameters
ParameterTypeDefaultDescription
mediastring

Music path.

Returns
dialoguestep

Created step.

Description

Creates a background music step.

# createNarrative METHOD
dialoguestep.createNarrative(text)
Static factory for narrative text step.
Parameters
ParameterTypeDefaultDescription
textstring

Narrative caption.

Returns
dialoguestep

Created step.

Description

Creates a narrative caption step.

# createPlayer METHOD
dialoguestep.createPlayer(text)
Static factory for player dialogue step.
Parameters
ParameterTypeDefaultDescription
textstring

Player line.

Returns
dialoguestep

Created step.

Description

Creates a player speech step.

# createRadio METHOD
dialoguestep.createRadio(entity, text)
Static factory for radio dialogue step.
Parameters
ParameterTypeDefaultDescription
entityentity|number

Radio transmission source.

textstring

Message.

Returns
dialoguestep

Created step.

Description

Creates a radio transmission step.

# createRandom METHOD
dialoguestep.createRandom()
Static factory for random branch step.
Parameters
None
Returns
dialoguestep

Created step.

Description

Creates a random choice step.

# createSwitch METHOD
dialoguestep.createSwitch(script)
Static factory for switch step.
Parameters
ParameterTypeDefaultDescription
scriptstring

Switch script.

Returns
dialoguestep

Created step.

Description

Creates a multi-case switch step.

# getOption METHOD
dialoguestep:getOption(index)
Gets data for a choice option.
Parameters
ParameterTypeDefaultDescription
indexnumber

1-based option index.

Returns
table

Option details table {text, connection, action, condition, target}.

Description

Returns table of option configuration.

# getOptions METHOD
dialoguestep:getOptions()
Gets all choice options.
Parameters
None
Returns
table

1-based array of option tables.

Description

Returns an array of option tables.

# new METHOD
dialoguestep.new([type], [text], [entity])
Constructs a new dialogue step.
Parameters
ParameterTypeDefaultDescription
typenumber|string|tableoptional

Step type or config table.

textstring""

Text line.

entityentity|numberoptional

Speaking entity.

Returns
dialoguestep

Created step.

Description

Creates a dialogue step with specified attributes.

# removeOption METHOD
dialoguestep:removeOption(index)
Removes a choice option by index.
Parameters
ParameterTypeDefaultDescription
indexnumber

1-based option index.

Returns
boolean

True if removed.

Description

Deletes option at index.

# setEntities METHOD
dialoguestep:setEntities(entitiesVal)
Sets associated entities.
Parameters
ParameterTypeDefaultDescription
entitiesValtable|entity|number

Associated entities.

Returns
dialoguestep

Self.

Description

Updates associated entities.

# setEntity METHOD
dialoguestep:setEntity(entityVal)
Sets speaking entity.
Parameters
ParameterTypeDefaultDescription
entityValentity|number|string|nil

Speaking entity.

Returns
dialoguestep

Self.

Description

Sets speaker entity.

# setExtraPosition METHOD
dialoguestep:setExtraPosition(arg1, [y], [z])
Sets 3D extra camera position.
Parameters
ParameterTypeDefaultDescription
arg1vector3|number

Position vector or X.

ynumber0

Y coordinate.

znumber0

Z coordinate.

Returns
dialoguestep

Self.

Description

Updates 3D target coordinates.

# setMedia METHOD
dialoguestep:setMedia(media)
Sets media resource path.
Parameters
ParameterTypeDefaultDescription
mediastring

Audio path.

Returns
dialoguestep

Self.

Description

Updates media path.

# setOptionAction METHOD
dialoguestep:setOptionAction(index, action)
Sets the Lua callback function executed when option is clicked.
Parameters
ParameterTypeDefaultDescription
indexnumber

1-based option index.

actionfunction|nil

Lua callback function.

Returns
boolean

True if updated.

Description

Assigns action callback.

# setOptionCondition METHOD
dialoguestep:setOptionCondition(index, conditionScript)
Sets the display condition script for an option.
Parameters
ParameterTypeDefaultDescription
indexnumber

1-based option index.

conditionScriptstring

Script returning boolean to show option.

Returns
boolean

True if updated.

Description

Controls whether option button appears based on condition.

# setOptionNext METHOD
dialoguestep:setOptionNext(index, target)
Updates the destination step of an option.
Parameters
ParameterTypeDefaultDescription
indexnumber

1-based option index.

targetdialoguestep|number|nil

Destination step.

Returns
boolean

True if updated.

Description

Wires option to target.

# setOptionText METHOD
dialoguestep:setOptionText(index, text)
Updates the label text of an option.
Parameters
ParameterTypeDefaultDescription
indexnumber

1-based option index.

textstring

New option label.

Returns
boolean

True if updated.

Description

Modifies option button text.

# setPosition METHOD
dialoguestep:setPosition(arg1, [y])
Sets 2D graph editor position.
Parameters
ParameterTypeDefaultDescription
arg1vector2|number

Position vector or X.

ynumber0

Y coordinate.

Returns
dialoguestep

Self.

Description

Updates position in graph.

# setScript METHOD
dialoguestep:setScript(script)
Sets activation script.
Parameters
ParameterTypeDefaultDescription
scriptstring

Lua script.

Returns
dialoguestep

Self.

Description

Updates script.

# setText METHOD
dialoguestep:setText(text)
Sets dialogue text line.
Parameters
ParameterTypeDefaultDescription
textstring

Text content.

Returns
dialoguestep

Self.

Description

Updates line text.

# setTitle METHOD
dialoguestep:setTitle(title)
Sets step title.
Parameters
ParameterTypeDefaultDescription
titlestring

Title string.

Returns
dialoguestep

Self.

Description

Updates step title.

# setType METHOD
dialoguestep:setType(typeVal)
Sets step type.
Parameters
ParameterTypeDefaultDescription
typeValnumber|string

Type ID or name.

Returns
dialoguestep

Self.

Description

Updates step type.

# show METHOD
dialoguestep:show()
Displays this step immediately in the dialogue UI.
Parameters
None
Returns
None (void)
Description

Opens dialogue screen and renders this step.