Skip to content

LSDE Dialog Engine / IDialogueEngine

Interface: IDialogueEngine ​

Defined in: types.ts:733

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:808

Get all currently active scene handles.

Returns ​

SceneHandle[]


getCurrentBlocks() ​

getCurrentBlocks(): Block[]

Defined in: types.ts:810

Get the current block of every active scene.

Returns ​

Block[]


getSceneConnections() ​

getSceneConnections(sceneId): BlueprintConnection[]

Defined in: types.ts:818

Every wire INSIDE a scene, flattened so each carries the block it leaves.

Graph inspection, for a debug view that wants to see the wiring without playing it. It has never had anything to do with going from one scene to another: a wire has never crossed a scene in any version of the format, and chaining two scenes is the game's own business.

Parameters ​

sceneId ​

string

Returns ​

BlueprintConnection[]


init() ​

init(options): DiagnosticReport

Defined in: types.ts:737

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

Parameters ​

options ​

InitOptions

Returns ​

DiagnosticReport


isRunning() ​

isRunning(): boolean

Defined in: types.ts:806

True if at least one scene is active.

Returns ​

boolean


onAction() ​

onAction(handler): void

Defined in: types.ts:762

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:751

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:758

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:760

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:756

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:746

Register a handler called when a block fails validation.

Parameters ​

handler ​

InvalidateBlockHandler

Returns ​

void


onResolveCharacter() ​

onResolveCharacter(fn): void

Defined in: types.ts:767

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

Parameters ​

fn ​

(characters) => Card | undefined

Returns ​

void


onResolveCondition() ​

onResolveCondition(evaluator): void

Defined in: types.ts:781

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:787

Register a handler called when any scene starts.

Parameters ​

handler ​

SceneLifecycleHandler

Returns ​

void


onSceneExit() ​

onSceneExit(handler): void

Defined in: types.ts:789

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

Parameters ​

handler ​

SceneLifecycleHandler

Returns ​

void


onValidateNextBlock() ​

onValidateNextBlock(handler): void

Defined in: types.ts:744

Register a handler called before each block to validate it.

Parameters ​

handler ​

ValidateNextBlockHandler

Returns ​

void


scene() ​

scene(sceneId): SceneHandle

Defined in: types.ts:794

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

Parameters ​

sceneId ​

string

Returns ​

SceneHandle


setLocale() ​

setLocale(locale): void

Defined in: types.ts:739

Set the active locale for text resolution.

Parameters ​

locale ​

string

Returns ​

void


stop() ​

stop(): void

Defined in: types.ts:804

Cancel every running scene.

Every one of them, even if a cleanup throws on the way — the first fault surfaces once there is nothing left to close. A scene opened twice is two scenes here, and both stop.

Returns ​

void