call: Difference between revisions
Jump to navigation
Jump to search
Killzone Kid (talk | contribs) (locality info is misleading and innapropriate) |
No edit summary |
||
Line 64: | Line 64: | ||
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]] | [[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]] | ||
[[Category:Command Group: Program Flow|CALL]] | [[Category:Command Group: Program Flow|CALL]] | ||
<!-- CONTINUE Notes --> | |||
<dl class="command_description"> | |||
<dd class="notedate">Posted on July 5, 2014 - 16:00 (UTC)</dd> | |||
<dt class="note">'''[[User:MattAka Horner|MattAka Horner]]'''</dt> | |||
<dd class="note"> | |||
<br> | |||
Sleeping in a called function only works if the function is called from a spawned thread or a script. You cannot call a function with a sleep in it from another called function or it returns a generic error. | |||
<br> | |||
<code> | |||
//Works | |||
[] spawn { | |||
[] call { | |||
sleep 3; | |||
hintSilent "Hello World!"; | |||
}; | |||
}; | |||
</code> | |||
<code> | |||
//Doesn't Work | |||
[] call { | |||
[] call { | |||
sleep 3; | |||
hintSilent "Hello World!"; | |||
}; | |||
}; | |||
</code> | |||
</dd> | |||
</dl> | |||
<!-- DISCONTINUE Notes --> |
Revision as of 17:00, 5 July 2014
Description
- Description:
- Executes the function string. The argument(s) (if any) are passed as _this. (argument(s) are passed in an array). To execute a sleep function in the called code, execute it with spawn instead.
- Groups:
- Uncategorised
Syntax
- Syntax:
- argument(s) call body
- Parameters:
- argument(s): Any Value - Optional. Argument that is passed to the function in the "_this" variable.
- body: Code - A function body provided directly 'inline' or the String returned from the commands loadFile or preprocessFile.
- Return Value:
- Anything - The last value given in the function is returned. See the topic Function for more information.
Examples
- Example 1:
call {"x = 3"}
- Example 2:
- Operation Flashpoint syntax:
_n = 3;
Armed Assault syntax:
call format [{var%1 = 0},_n];_n = 3;
result of both syntaxes is var3 = 0
call compile format ["var%1 = 0",_n]; - Example 3:
- Operation Flashpoint syntax:
_fAdd = loadFile "add.sqf" [1,2] call _fAdd
Armed Assault syntax:_fAdd = compile loadFile "add.sqf" _result = [1,2] call _fAdd
Additional Information
- See also:
- spawncompilepreprocessFile
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
- Posted on July 5, 2014 - 16:00 (UTC)
- MattAka Horner
-
Sleeping in a called function only works if the function is called from a spawned thread or a script. You cannot call a function with a sleep in it from another called function or it returns a generic error.
//Works [] spawn { [] call { sleep 3; hintSilent "Hello World!"; }; };
//Doesn't Work [] call { [] call { sleep 3; hintSilent "Hello World!"; }; };
Categories:
- Scripting Commands
- Introduced with Operation Flashpoint: Resistance version 1.85
- Operation Flashpoint: Resistance: New Scripting Commands
- Operation Flashpoint: Resistance: Scripting Commands
- Command Group: Uncategorised
- Scripting Commands OFP 1.96
- Scripting Commands ArmA
- Scripting Commands ArmA2
- Scripting Commands Arma 3
- Scripting Commands Take On Helicopters
- Command Group: Program Flow