FSM Class
The FSM class contains three properties and a collection of States.
- fsmName: This property takes a string argument and defines the name of the FSM.
- initState: This property takes a string argument and refers the engine to begin at a predefined state in the state collection.
- finalStates: This property takes an array of string arguments. Once the FSM reaches and of final states, it is flagged and finished.
The scripted FSM structure normally consists of one
init state, one or more
conditional links, one or more
normal states and one or more
final states. Each state has init and precondition section, while each conditional link has precondition, condition and action sections. The order of execution is:
- State: init → precondition
- Conditional link (condition is true): precondition → condition → action
- Conditional link (condition is false): precondition → condition
Scripted FSMs are added into the scheduler just like
exec scripts,
execVM scripts and
spawn scripts.
To see what FSMs are currently in the scheduler, use
diag_activeMissionFSMs command.
⚠
While the code placed into any of the sections of FSM cannot be suspended (
canSuspend is false), the FSM itself is suspended every simulation between the state's init and precondition (exception is the
init state).
The usual difference between the state's init and precondition is 1 frame but if the scheduler is busy it can take longer.
This is the only place where scripted FSM is suspended/resumed.