call: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\[\[Category:Scripting Commands OFP 1.[4-9]{2}(\|(\{\{uc:\{\{PAGENAME\}\}\}\}|#))?\]\] " to "")
m (formatting)
Line 1: Line 1:
{{RV|type=command
{{RV|type=command


| ofpr
|game1= ofp
 
|version1= 1.85
 
|game2= ofpe
 
|version2= 1.00
 
|game3= arma1
 
|version3= 1.00
 
|game4= arma2
 
|version4= 1.00
 
|game5= arma2oa
 
|version5= 1.51
 
|game6= tkoh
 
|version6= 1.00
 
|game7= arma3
 
|version7= 0.50


|gr1= Program Flow
|gr1= Program Flow


|1.85
|descr= Adds given set of compiled instructions to the current stack and waits for it to finish and return, provides an option to pass arguments to the executed [[Code]]. See [[Scheduler]] to learn more about how the code is excuted and behaves.
 
| Adds given set of compiled instructions to the current stack and waits for it to finish and return, provides an option to pass arguments to the executed [[Code]].
{{Feature | Informative | See also [[Scheduler]].}}
{{Feature | important | This command accepts [[String]] (as well as [[Code]]) only in {{GameCategory|ofp|link=y}}. For later titles, see [[compile]].}}


| [[call]] code
|s1= [[call]] code


|p1= code: [[Code]] - [[compile]]d instructions
|p1= code: [[Code]] - [[compile|Compiled]] instructions. In {{ofp}} this command also accepts datatype [[String|string]]


| [[Anything]] - The last value given in the function is returned. See the topic [[Function#Return_Values|Function]] for more information.
|r1= [[Anything]] - The last value given in the function is returned. See the topic [[Function#Return_Values|Function]] for more information.


|s2= args [[call]] code
|s2= args [[call]] code
Line 21: Line 43:
|p21= args: [[Anything]] -  Arguments that are passed to the function in the [[Magic Variables#this|_this]] variable
|p21= args: [[Anything]] -  Arguments that are passed to the function in the [[Magic Variables#this|_this]] variable


|p22= code: [[Code]] - [[compile|compiled]] instructions
|p22= code: [[Code]] - [[compile|Compiled]] instructions. In {{ofp}} this command also accepts datatype [[String|string]]


|r2= [[Anything]] - The last value given in the function is returned. See the topic [[Function#Return_Values|Function]] for more information.
|r2= [[Anything]] - The last value given in the function is returned. See the topic [[Function#Return_Values|Function]] for more information.
Line 36: Line 58:
|x5= <code>_result = 123 [[call]] [[compile]] [[preprocessFileLineNumbers]] "myFile.sqf";</code>
|x5= <code>_result = 123 [[call]] [[compile]] [[preprocessFileLineNumbers]] "myFile.sqf";</code>


|seealso= [[spawn]], [[execVM]], [[canSuspend]], [[compile]], [[preprocessFile]], [[remoteExec]], [[remoteExecCall]]
|seealso= [[spawn]] [[execVM]] [[canSuspend]] [[compile]] [[compileScript]] [[preprocessFile]] [[remoteExec]] [[remoteExecCall]]
}}
}}
{{GameCategory|arma1|Scripting Commands}}
{{GameCategory|arma2|Scripting Commands}}
{{GameCategory|tkoh|Scripting Commands}}
{{GameCategory|arma3|Scripting Commands}}

Revision as of 10:06, 27 March 2021

Hover & click on the images for description

Description

Description:
Adds given set of compiled instructions to the current stack and waits for it to finish and return, provides an option to pass arguments to the executed Code. See Scheduler to learn more about how the code is excuted and behaves.
Groups:
Program Flow

Syntax

Syntax:
call code
Parameters:
code: Code - Compiled instructions. In Operation Flashpoint this command also accepts datatype string
Return Value:
Anything - The last value given in the function is returned. See the topic Function for more information.

Alternative Syntax

Syntax:
args call code
Parameters:
args: Anything - Arguments that are passed to the function in the _this variable
code: Code - Compiled instructions. In Operation Flashpoint this command also accepts datatype string
Return Value:
Anything - The last value given in the function is returned. See the topic Function for more information.

Examples

Example 1:
call { hint str 123; };
Example 2:
123 call { hint str _this; };
Example 3:
_sum = [1, 2] call { (_this select 0) + (_this select 1); }; hint str _sum; // displays 3
Example 4:
123 call compile "hint str _this;";
Example 5:
_result = 123 call compile preprocessFileLineNumbers "myFile.sqf";

Additional Information

See also:
spawn execVM canSuspend compile compileScript preprocessFile remoteExec remoteExecCall

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