DCode

Covers Engine 2.0.0

task_state_machine

Define a named-state CAESAR task in DCode.

Syntax

task_state_machine <name>:

Available in

  • File scope

Lifecycle

Activation declares states and task channels; the current handler runs while active and transitions only when script code requests one.

Persistence

The state table and current state remain available between handler calls while the task is loaded.

Reload behavior

DARTWIC tracks changes to the block and its template dependencies when loading the task.

Runtime sections

  • states
  • start
  • state
  • missed
  • end

Generated channels

  • <name>_running
  • <name>_target_frequency
  • <name>_actual_frequency
  • <name>_hold
  • <name>_current_state
  • <name>_target_state
  • <name>_failed_cycles

Example

task_state_machine task_name:
    states:
        idle
        running

    state idle:
        if target_state == states.running:
            transition running