Skip to content

LSDE Dialog Engine / ValidateNextBlockArgs

Interface: ValidateNextBlockArgs

Defined in: types.ts:789

Arguments for the onValidateNextBlock handler.

Remarks

Called before each block is executed. Provides the resolved character for both the upcoming block (nextContext) and the previously executed block (fromContext). This enables game-side validation such as character authorization, status checks, or transition rules between characters.

fromContext is null for the first block of a scene (no previous block exists).

Example

ts
engine.onValidateNextBlock(({ nextBlock, nextContext, fromContext }) => {
  const { character } = nextContext;
  if (!character) return { valid: false, reason: 'no_character' };
  if (game.characterHasStatus(character, 'stunned'))
    return { valid: false, reason: 'character_stunned' };
  return { valid: true };
});

See

Properties

fromBlock

fromBlock: BlueprintBlock | null

Defined in: types.ts:793

The block that was just executed, or null for the first block of the scene.


fromContext

fromContext: ValidateNextBlockContext | null

Defined in: types.ts:797

Context for the previous block, or null if this is the first block.


nextBlock

nextBlock: BlueprintBlock

Defined in: types.ts:791

The block about to be executed.


nextContext

nextContext: ValidateNextBlockContext

Defined in: types.ts:795

Context for the upcoming block (character, etc.).


port

port: string | null

Defined in: types.ts:799

The port that was followed to reach nextBlock (reserved for future use).