WSF_STATE_MACHINE

Derives From: WSF_SCRIPT_PROCESSOR

processor WSF_STATE_MACHINE
processor <name> WSF_STATE_MACHINE

  WSF_SCRIPT_PROCESSOR Commands ...

  show_state_evaluations
  show_state_transitions

  state <state-name>
     ... state definition ...
  end_state

  # Script Interface

   on_initialize ... end_on_initialize
   on_initialize2 ... end_on_initialize2
   on_update ... end_on_update
   script_variables ... end_script_variables
   script ... end_script
   .. Other Script Commands ...

end_processor

Overview

WSF_STATE_MACHINE uses the concept of a finite state machine. The user defines a set of transition rules that define the conditions under which a transition can occur from one state to another. The transition rules are defined using the WSF scripting language. Similar to the WSF_SCRIPT_PROCESSOR, the WSF_STATE_MACHINE does not have direct access to tracks; hence, the TRACK variable cannot be used.

Commands

show_state_evaluations

Indicates that information about state evaluations should be written to standard output. This essentially shows the true or false status of the evaluation of each next_state block.

show_state_transitions

Indicates that information about state transitions should be written to standard output.

state <state-name>

Defines a state in a state machine with the name <state-name>. Besides transition conditions, notice a state can have its own behavior_tree inside.

  state <state-name>
    on_entry
       ...
    end_on_entry
    on_exit
       ...
    end_on_exit
    next_state <next-state-name-1>
       ...
    end_next_state
    next_state <next-state-name-n>
       ...
    end_next_state
    behavior_tree
        behavior_tree Commands ...
    end_behavior_tree
end_state

Script Interface

WSF_STATE_MACHINE utilizes the capabilities of the Common Script Interface and WSF_SCRIPT_PROCESSOR.