Skip to content

LSDE Dialog Engine / IDialogueEngine

Interface: IDialogueEngine

Defined in: types.ts:955

Public interface for the dialogue engine facade.

Remarks

This is the top-level entry point for the LSDEDE runtime. It manages blueprint loading, global handler registration, and scene creation. Use SceneHandle for per-scene control.

See

SceneHandle for per-scene runtime control

Methods

getActiveScenes()

getActiveScenes(): SceneHandle[]

Defined in: types.ts:1027

Get all currently active scene handles.

Returns

SceneHandle[]


getCurrentBlocks()

getCurrentBlocks(): BlueprintBlock[]

Defined in: types.ts:1029

Get the current block of every active scene.

Returns

BlueprintBlock[]


getSceneConnections()

getSceneConnections(sceneId): BlueprintConnection[]

Defined in: types.ts:1031

Get connections for a scene (for inter-scene navigation).

Parameters

sceneId

string

Returns

BlueprintConnection[]


init()

init(options): DiagnosticReport

Defined in: types.ts:959

Validate blueprint data, build internal graph, return diagnostic report.

Parameters

options

InitOptions

Returns

DiagnosticReport


isRunning()

isRunning(): boolean

Defined in: types.ts:1025

True if at least one scene is active.

Returns

boolean


onAction()

onAction(handler): void

Defined in: types.ts:984

Register a global handler for ACTION blocks. The developer MUST handle execution in this handler.

Parameters

handler

ActionHandler

Returns

void


onBeforeBlock()

onBeforeBlock(handler): void

Defined in: types.ts:973

Register a handler called before every block. Must call resolve() to continue.

Parameters

handler

BeforeBlockHandler

Returns

void


onChoice()

onChoice(handler): void

Defined in: types.ts:980

Register a global handler for CHOICE blocks. All choices are provided, tagged with visible when onResolveCondition() is configured.

Parameters

handler

ChoiceHandler

Returns

void


onCondition()

onCondition(handler): void

Defined in: types.ts:982

Register a global handler for CONDITION blocks. The developer MUST handle evaluation in this handler.

Parameters

handler

ConditionHandler

Returns

void


onDialog()

onDialog(handler): void

Defined in: types.ts:978

Register a global handler for DIALOG blocks. May return a cleanup function.

Parameters

handler

DialogHandler

Returns

void


onInvalidateBlock()

onInvalidateBlock(handler): void

Defined in: types.ts:968

Register a handler called when a block fails validation.

Parameters

handler

InvalidateBlockHandler

Returns

void


onResolveCharacter()

onResolveCharacter(fn): void

Defined in: types.ts:989

Register a global character resolver. Called for every block with metadata.characters.

Parameters

fn

(characters) => BlockCharacter | undefined

Returns

void


onResolveCondition()

onResolveCondition(evaluator): void

Defined in: types.ts:1003

Install a unified condition evaluator for both choice visibility and condition block pre-evaluation. The engine handles choice: conditions internally via choice history — this callback evaluates game-state conditions only.

When installed:

  • Choice blocks: each choice is tagged with visible: true | false based on its visibilityConditions.
  • Condition blocks: each group is pre-evaluated and the result is available in context.groups[i].result and context.evaluation.

Parameters

evaluator

(condition) => boolean

Returns

void


onSceneEnter()

onSceneEnter(handler): void

Defined in: types.ts:1011

Register a handler called when any scene starts.

Parameters

handler

SceneLifecycleHandler

Returns

void


onSceneExit()

onSceneExit(handler): void

Defined in: types.ts:1013

Register a handler called when any scene ends (natural or cancelled).

Parameters

handler

SceneLifecycleHandler

Returns

void


onValidateNextBlock()

onValidateNextBlock(handler): void

Defined in: types.ts:966

Register a handler called before each block to validate it.

Parameters

handler

ValidateNextBlockHandler

Returns

void


scene()

scene(sceneId): SceneHandle

Defined in: types.ts:1018

Create a scene handle. Does NOT start the flow — call handle.start().

Parameters

sceneId

string

Returns

SceneHandle


setChoiceFilter()

setChoiceFilter(evaluator): void

Defined in: types.ts:1006

Parameters

evaluator

(condition) => boolean

Returns

void

Deprecated

Use onResolveCondition instead.


setLocale()

setLocale(locale): void

Defined in: types.ts:961

Set the active locale for text resolution.

Parameters

locale

string

Returns

void


stop()

stop(): void

Defined in: types.ts:1023

Stop all active scenes.

Returns

void