execFSM: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(see also)
mNo edit summary
Line 7: Line 7:
____________________________________________________________________________________________
____________________________________________________________________________________________


| Executes scripted [[FSM]] and returns the FSM handle or 0 when failed. The FSM file is first searched in the mission folder, then in the campaign scripts folder and finally in the global scripts folder. Argument (if any) are available in <tt>_this</tt> variable inside FSM. In Arma 3 FSM handle is also available in <tt>_thisFSM</tt> variable.<br><br>
| Executes scripted [[FSM]] and returns the FSM handle or 0 when failed. The FSM file is first searched in the mission folder, then in the campaign scripts folder and finally in the global scripts folder. Argument (if any) are available in <tt>_this</tt> variable inside FSM. In Arma 3 FSM handle is also available in <tt>_thisFSM</tt> variable. Variables set inside FSMs can be read/modified externally, using [[setFSMVariable]] and [[getFSMVariable]] commands.<br><br>
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 <tt>init</tt> and <tt>precondition</tt> section, while each conditional link has <tt>precondition</tt>, <tt>condition</tt> and <tt>action</tt> sections. The order of execution is:
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 <tt>init</tt> and <tt>precondition</tt> section, while each conditional link has <tt>precondition</tt>, <tt>condition</tt> and <tt>action</tt> sections. The order of execution is:
* State: <tt>init</tt>-><tt>precondition</tt>
* State: <tt>init</tt>-><tt>precondition</tt>

Revision as of 12:42, 9 February 2019

Hover & click on the images for description

Description

Description:
Executes scripted FSM and returns the FSM handle or 0 when failed. The FSM file is first searched in the mission folder, then in the campaign scripts folder and finally in the global scripts folder. Argument (if any) are available in _this variable inside FSM. In Arma 3 FSM handle is also available in _thisFSM variable. Variables set inside FSMs can be read/modified externally, using setFSMVariable and getFSMVariable commands.

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. 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 state's init and state's precondition (exception is the init state). Normally the difference between 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.

To see what FSMs are currently in the scheduler, use diag_activeMissionFSMs command
Groups:
Uncategorised

Syntax

Syntax:
arguments execFSM filename
Parameters:
arguments: Anything - Arguments accessible as _this in the FSM
filename: String - file with FSM code
Return Value:
Number - FSM handle, can be used to determine (via completedFSM) when the execed FSM has finished. In Arma 3, the handle is also available inside the FSM in _thisFSM variable.

Alternative Syntax

Syntax:
execFSM filename
Parameters:
filename: String - file with FSM code String
Return Value:
Number - FSM handle, can be used to determine (via completedFSM) when the execed FSM has finished. In Arma 3, the handle is also available inside the FSM in _thisFSM variable.

Examples

Example 1:
_id = player execFSM "test.fsm";
Example 2:
_handle = [_a, _b, _c] execFSM "test.fsm";
Example 3:
_handle = execFSM "test.fsm";

Additional Information

See also:
FSMFSM Editor ManualexecVMcallspawnexeccommandFSMcompletedFSMdoFSMgetFSMVariablesetFSMVariable

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note

Notes

Bottom Section