Script Listener Actions

Overview

Script hooks execute action arrays through a single validated path.

Supported hooks:

  • onRun
  • onStateChange

Supported actions:

  • set-input
  • fire-trigger
  • set-object-property
  • seek-timeline
  • play-state-machine
  • set-script-input

Validation Contract

Action payloads are validated before execution.

  • Non-finite numbers are rejected.
  • set-object-property validates by target property type.
  • Invalid actions are reported in diagnostics and stop the current action chain.

Binding Behavior

Hooks run automatically when a script is bound to a target and the runtime event matches.

  • global bindings always match.
  • stateMachine bindings match by state machine ID.

Use:

  • bindScript(scriptId, binding)
  • unbindScript(scriptId, bindingId)

Diagnostics

Read latest hook execution diagnostics via:

  • getScriptDiagnostics(scriptId)

Each result includes:

  • action payload
  • ok
  • message
  • executedAtMs