Difference between revisions of "execFSM"
Jump to navigation
Jump to search
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...) |
Lou Montana (talk | contribs) m (Text replacement - "\|x([0-9])= *<code>([^<]*)<\/code>" to "|x$1= <sqf>$2</sqf>") |
||
(32 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | {{ | + | {{RV|type=command |
− | | arma2 | + | |game1= arma2 |
+ | |version1= 1.00 | ||
− | |1. | + | |game2= arma2oa |
+ | |version2= 1.50 | ||
+ | |game3= tkoh | ||
+ | |version3= 1.00 | ||
+ | |||
+ | |game4= arma3 | ||
+ | |version4= 0.50 | ||
|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 | + | |descr= 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 {{hl|_this}} variable inside FSM. Variables set inside FSMs can be read/modified externally, using [[setFSMVariable]] and [[getFSMVariable]] commands.<br> |
<br> | <br> | ||
The return value is the FSM handle; it can be used to determine (via [[completedFSM]]) when the FSM has finished. | The return value is the FSM handle; it can be used to determine (via [[completedFSM]]) when the FSM has finished. | ||
− | {{Feature|arma3|In Arma 3, the FSM handle is also available within the FSM through the | + | {{Feature|arma3|In Arma 3, the FSM handle is also available within the FSM through the {{hl|_thisFSM}} variable.}} |
<br> | <br> | ||
Scripted FSMs are added into the scheduler just like [[exec]] scripts, [[execVM]] scripts and [[spawn]] scripts.<br> | Scripted FSMs are added into the scheduler just like [[exec]] scripts, [[execVM]] scripts and [[spawn]] scripts.<br> | ||
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. | ||
− | {{ | + | {{Feature|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 {{hl|init}} and {{hl|precondition}} (exception is the '''init state'''). This is the only place where scripted FSM is suspended/resumed. |
− | The usual difference between the state's | + | The usual difference between the state's {{hl|init}} and {{hl|precondition}} 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 | + | |s1= arguments [[execFSM]] fsmFilePath |
− | |p1= arguments: [[Anything]] - Arguments accessible as | + | |p1= arguments: [[Anything]] - Arguments accessible as {{hl|_this}} in the FSM |
|p2= fsmFilePath: [[String]] - file with FSM code | |p2= fsmFilePath: [[String]] - file with FSM code | ||
− | | [[Number]] - FSM handle | + | |r1= [[Number]] - FSM handle |
− | |s2= [[execFSM]] fsmFilePath | + | |s2= [[execFSM]] fsmFilePath |
− | |p21= fsmFilePath: [[String]] - file with FSM code | + | |p21= fsmFilePath: [[String]] - file with FSM code |
− | | r2= [[Number]] - FSM handle | + | |r2= [[Number]] - FSM handle |
− | |x1= < | + | |x1= <sqf>_id = player execFSM "test.fsm";</sqf> |
− | |x2= < | + | |x2= <sqf>_handle = [_a, _b, _c] execFSM "test.fsm";</sqf> |
− | |x3= < | + | |x3= <sqf>_handle = execFSM "test.fsm";</sqf> |
− | | [[FSM]] | + | |seealso= [[FSM]] [[FSM Editor Manual]] [[execVM]] [[call]] [[spawn]] [[exec]] [[commandFSM]] [[completedFSM]] [[doFSM]] [[getFSMVariable]] [[setFSMVariable]] |
}} | }} | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Latest revision as of 11:21, 13 May 2022
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:
- Example 2:
- Example 3:
Additional Information
- See also:
- FSM FSM Editor Manual execVM call spawn exec commandFSM completedFSM doFSM getFSMVariable setFSMVariable
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