call: Difference between revisions
Jump to navigation
Jump to search
(add. classification) |
(merged call pages) |
||
Line 13: | Line 13: | ||
| Executes the function string. | | Executes the function string. | ||
The ''argument(s)'' (if any) are passed as _this. (''argument(s)'' are passed in an array) |= Description | 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. |= Description | |||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
Line 27: | Line 29: | ||
The last value given in the function is returned. See the topic [[Function]] for more information. |= Return value | The last value given in the function is returned. See the topic [[Function]] for more information. |= Return value | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
|x1= ''[[:Category:Operation Flashpoint|Operation Flashpoint]] syntax:'' | |x1= <code>call {"x <nowiki>=</nowiki> 3"}</code> |= Example 1 | ||
|x2= ''[[:Category:Operation Flashpoint|Operation Flashpoint]] syntax:'' | |||
<code>_n <nowiki>=</nowiki> 3;<br />call [[format]] [{var%1 <nowiki>=</nowiki> 0},_n];</code> | |||
''[[:Category:Armed Assault|Armed Assault]] syntax:'' | |||
<code>_n <nowiki>=</nowiki> 3;<br />call [[compile]] [[format]] ["var%1 <nowiki>=</nowiki> 0",_n];</code> | |||
result of both syntaxes is '''var3 <nowiki>=</nowiki> 0'''|= Example 2 | |||
|x3= ''[[:Category:Operation Flashpoint|Operation Flashpoint]] syntax:'' | |||
<code>_fAdd <nowiki>=</nowiki> loadFile "add.sqf" | <code>_fAdd <nowiki>=</nowiki> loadFile "add.sqf" | ||
[1,2] call _fAdd</code> | [1,2] call _fAdd</code> | ||
''[[:Category:Armed Assault|Armed Assault]] syntax:'' | |||
<code>_fAdd <nowiki>=</nowiki> [[compile]] loadFile "add.sqf" | <code>_fAdd <nowiki>=</nowiki> [[compile]] loadFile "add.sqf" | ||
_result <nowiki>=</nowiki> [1,2] call _fAdd</code> |= Example | _result <nowiki>=</nowiki> [1,2] call _fAdd</code> | ||
|= Example 3 | |||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| | | [[spawn]], [[compile]], [[preprocessFile]] |= See also | ||
}} | }} | ||
Line 44: | Line 54: | ||
<dl class="command_description"> | <dl class="command_description"> | ||
<!-- Note Section BEGIN --> | <!-- Note Section BEGIN --> | ||
<!-- Note Section END --> | <!-- Note Section END --> |
Revision as of 14:20, 15 June 2010
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
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: Local Effect
- Scripting Commands OFP 1.96
- Scripting Commands ArmA
- Command Group: Program Flow
- Scripting Commands VBS2