Skip to content

LSDE Dialog Engine / ValidateNextBlockArgs

Interface: ValidateNextBlockArgs ​

Defined in: types.ts:558

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: Block | null

Defined in: types.ts:562

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


fromContext ​

fromContext: ValidateNextBlockContext | null

Defined in: types.ts:566

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


nextBlock ​

nextBlock: Block

Defined in: types.ts:560

The block about to be executed.


nextContext ​

nextContext: ValidateNextBlockContext

Defined in: types.ts:564

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


port ​

port: string | null

Defined in: types.ts:568

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