execFSM: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "_{10,} " to "") |
Lou Montana (talk | contribs) m (Text replacement - " *\| *([Cc]omments|COMMENTS|Game|[Gg]ame [Nn]ame|Game [Vv]ersion|Game Version \(number surrounded by NO SPACES\)|Multiplayer Arguments( \("local" or "global"\))?|Effects|Multiplayer Effects( \("local" or "global"\))?|Multiplayer Exe...) |
||
Line 1: | Line 1: | ||
{{Command | {{Command | ||
| arma2 | | arma2 | ||
|1.00 | |1.00 | ||
|gr1= Program Flow | |gr1= Program Flow | ||
| Execute scripted [[FSM]] and return 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. Variables set inside FSMs can be read/modified externally, using [[setFSMVariable]] and [[getFSMVariable]] commands.<br> | | Execute scripted [[FSM]] and return 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. Variables set inside FSMs can be read/modified externally, using [[setFSMVariable]] and [[getFSMVariable]] commands.<br> | ||
Line 16: | Line 16: | ||
To see what FSMs are currently in the scheduler, use [[diag_activeMissionFSMs]] command. | To see what FSMs are currently in the scheduler, use [[diag_activeMissionFSMs]] command. | ||
{{Important|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 <tt>init</tt> and <tt>precondition</tt> (exception is the '''init state'''). This is the only place where scripted FSM is suspended/resumed. | {{Important|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 <tt>init</tt> and <tt>precondition</tt> (exception is the '''init state'''). This is the only place where scripted FSM is suspended/resumed. | ||
The usual difference between the state's <tt>init</tt> and <tt>precondition</tt> is 1 frame but if the scheduler is busy it can take longer. See [[FSM]] for more information about FSM's structure.}} | The usual difference between the state's <tt>init</tt> and <tt>precondition</tt> is 1 frame but if the scheduler is busy it can take longer. See [[FSM]] for more information about FSM's structure.}} | ||
| arguments [[execFSM]] fsmFilePath | | arguments [[execFSM]] fsmFilePath | ||
|p1= arguments: [[Anything]] - Arguments accessible as <tt>_this</tt> in the FSM | |p1= arguments: [[Anything]] - Arguments accessible as <tt>_this</tt> in the FSM | ||
|p2= fsmFilePath: [[String]] - file with FSM code | |p2= fsmFilePath: [[String]] - file with FSM code | ||
| [[Number]] - FSM handle | | [[Number]] - FSM handle | ||
|s2= [[execFSM]] fsmFilePath |Syntax 2= | |s2= [[execFSM]] fsmFilePath |Syntax 2= | ||
Line 30: | Line 30: | ||
|p21= fsmFilePath: [[String]] - file with FSM code |Parameter 21= | |p21= fsmFilePath: [[String]] - file with FSM code |Parameter 21= | ||
| r2= [[Number]] - FSM handle | | r2= [[Number]] - FSM handle | ||
|x1= <code>_id = [[player]] [[execFSM]] "test.fsm";</code> | |x1= <code>_id = [[player]] [[execFSM]] "test.fsm";</code> | ||
|x2= <code>_handle = [_a, _b, _c] [[execFSM]] "test.fsm";</code> | |x2= <code>_handle = [_a, _b, _c] [[execFSM]] "test.fsm";</code> | ||
|x3= <code>_handle = [[execFSM]] "test.fsm";</code> | |x3= <code>_handle = [[execFSM]] "test.fsm";</code> | ||
| [[FSM]], [[FSM Editor Manual]], [[execVM]], [[call]], [[spawn]], [[exec]], [[commandFSM]], [[completedFSM]], [[doFSM]], [[getFSMVariable]], [[setFSMVariable]] | | [[FSM]], [[FSM Editor Manual]], [[execVM]], [[call]], [[spawn]], [[exec]], [[commandFSM]], [[completedFSM]], [[doFSM]], [[getFSMVariable]], [[setFSMVariable]] | ||
}} | }} | ||
Revision as of 00:36, 18 January 2021
Description
- Description:
- Execute scripted FSM and return 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. Variables set inside FSMs can be read/modified externally, using setFSMVariable and getFSMVariable commands.
The return value is the FSM handle; it can be used to determine (via completedFSM) when the FSM has finished.
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. - Groups:
- Program Flow
Syntax
- Syntax:
- arguments execFSM fsmFilePath
- Parameters:
- arguments: Anything - Arguments accessible as _this in the FSM
- fsmFilePath: String - file with FSM code
- Return Value:
- Number - FSM handle
Alternative Syntax
- Syntax:
- execFSM fsmFilePath
- Parameters:
- fsmFilePath: String - file with FSM code
- Return Value:
- Number - FSM handle
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