call: Difference between revisions
| Killzone Kid (talk | contribs)  (linked _this) | Sarogahtyp (talk | contribs)  mNo edit summary | ||
| Line 66: | Line 66: | ||
| <dd class="note"> | <dd class="note"> | ||
| <br> | <br> | ||
| A called function may only use suspension ([[sleep]], [[uiSleep]], [[waitUntil]]) if it originates in a scheduled environment. If the called function originates in a non-scheduled environment it will return a generic error. | A called function may only use suspension ([[sleep]], [[uiSleep]], [[waitUntil]]) if it originates in a [[Scheduler#Scheduled_Environment|scheduled environment]]. If the called function originates in a [[Scheduler#Unscheduled_Environment|non-scheduled environment]] it will return a generic error. | ||
| <br> | <br> | ||
| <code>// *** non-scheduled origin *** | <code>// *** [[Scheduler#Unscheduled_Environment|non-scheduled]] origin *** | ||
| [] [[spawn]] { | [] [[spawn]] { | ||
| 	// *** scheduled scope *** | 	// *** [[Scheduler#Scheduled_Environment|scheduled]] scope *** | ||
| 	[] [[call]] { | 	[] [[call]] { | ||
| 		// *** scheduled scope *** | 		// *** [[Scheduler#Scheduled_Environment|scheduled]] scope *** | ||
| 		[[sleep]] 3; // <- OK | 		[[sleep]] 3; // <- OK | ||
| 		[[hintSilent]] "Hello World!"; | 		[[hintSilent]] "Hello World!"; | ||
| Line 79: | Line 79: | ||
| </code> | </code> | ||
| <code>// *** non-scheduled origin *** | <code>// *** [[Scheduler#Unscheduled_Environment|non-scheduled]] origin *** | ||
| [] [[call]] { | [] [[call]] { | ||
| 	// *** non-scheduled scope*** | 	// *** [[Scheduler#Unscheduled_Environment|non-scheduled]] scope*** | ||
| 	[] [[call]] { | 	[] [[call]] { | ||
| 		// *** non-scheduled scope *** | 		// *** [[Scheduler#Unscheduled_Environment|non-scheduled]] scope *** | ||
| 		[[sleep]] 3; // <- NOT OK | 		[[sleep]] 3; // <- NOT OK | ||
| 		[[hintSilent]] "Hello World!"; | 		[[hintSilent]] "Hello World!"; | ||
| Line 90: | Line 90: | ||
| </code> | </code> | ||
| <code>// *** scheduled origin *** | <code>// *** [[Scheduler#Scheduled_Environment|scheduled]] origin *** | ||
| [] [[spawn]] { | [] [[spawn]] { | ||
| 	// *** scheduled scope *** | 	// *** [[Scheduler#Scheduled_Environment|scheduled]] scope *** | ||
| 	[] [[call]] { | 	[] [[call]] { | ||
| 		// *** scheduled scope *** | 		// *** [[Scheduler#Scheduled_Environment|scheduled]] scope *** | ||
| 		[[sleep]] 3; // <- OK | 		[[sleep]] 3; // <- OK | ||
| 		[[hintSilent]] "Hello World!"; | 		[[hintSilent]] "Hello World!"; | ||
| Line 101: | Line 101: | ||
| </code> | </code> | ||
| <code>// *** scheduled origin *** | <code>// *** [[Scheduler#Scheduled_Environment|scheduled]] origin *** | ||
| [] [[call]] { | [] [[call]] { | ||
| 	// *** scheduled scope*** | 	// *** [[Scheduler#Scheduled_Environment|scheduled]] scope*** | ||
| 	[] [[call]] { | 	[] [[call]] { | ||
| 		// *** scheduled scope *** | 		// *** [[Scheduler#Scheduled_Environment|scheduled]] scope *** | ||
| 		[[sleep]] 3; // <- OK | 		[[sleep]] 3; // <- OK | ||
| 		[[hintSilent]] "Hello World!"; | 		[[hintSilent]] "Hello World!"; | ||
| Line 120: | Line 120: | ||
| <dt class="note">[[User:Patriot821|Patriot821]]</dt> | <dt class="note">[[User:Patriot821|Patriot821]]</dt> | ||
| <dd class="note"> | <dd class="note"> | ||
| If the code is in non-scheduled scope and contains while-do statement, the code runs only  | If the code is in [[Scheduler#Unscheduled_Environment|non-scheduled]] scope and contains while-do statement, the code runs only 10,000 times at the maximum, even if the statement makes infinite loop. (ARMA3 Ver. 1.38.128937) | ||
| <code>// *** non-scheduled origin *** | <code>// *** [[Scheduler#Unscheduled_Environment|non-scheduled]] origin *** | ||
| [] call { | [] call { | ||
| 	// *** non-scheduled scope*** | 	// *** [[Scheduler#Unscheduled_Environment|non-scheduled]] scope*** | ||
| 	[] call { | 	[] call { | ||
| 		// *** non-scheduled scope *** | 		// *** [[Scheduler#Unscheduled_Environment|non-scheduled]] scope *** | ||
| 		_a<nowiki>=</nowiki>0; | 		_a<nowiki>=</nowiki>0; | ||
| 		while{_a<15000} do{ | 		while{_a<15000} do{ | ||
Revision as of 12:13, 20 June 2017
Description
- Description:
- Executes given set of compiled instructions with an option to pass arguments to the executed Code. In OFP this command used to accept String for the code.
- Groups:
- Uncategorised
Syntax
- Syntax:
- call code
- Parameters:
- code: Code - compiled instructions
- 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
- 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; //3
- Example 4:
- 123 call compile "hint str _this";
- Example 5:
- _result = 123 call compile preprocessFileLineNumbers "myfile.sqf";
Additional Information
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
- 
 A called function may only use suspension (sleep, uiSleep, waitUntil) if it originates in a scheduled environment. If the called function originates in a non-scheduled environment it will return a generic error.
 // *** non-scheduled origin *** [] spawn { // *** scheduled scope *** [] call { // *** scheduled scope *** sleep 3; // <- OK hintSilent "Hello World!"; }; };// *** non-scheduled origin *** [] call { // *** non-scheduled scope*** [] call { // *** non-scheduled scope *** sleep 3; // <- NOT OK hintSilent "Hello World!"; }; };// *** scheduled origin *** [] spawn { // *** scheduled scope *** [] call { // *** scheduled scope *** sleep 3; // <- OK hintSilent "Hello World!"; }; };// *** scheduled origin *** [] call { // *** scheduled scope*** [] call { // *** scheduled scope *** sleep 3; // <- OK hintSilent "Hello World!"; }; };
- Posted on February 17, 2015 - 11:02 (UTC)
- Patriot821
- 
If the code is in non-scheduled scope and contains while-do statement, the code runs only 10,000 times at the maximum, even if the statement makes infinite loop. (ARMA3 Ver. 1.38.128937)
// *** non-scheduled origin *** [] call { // *** non-scheduled scope*** [] call { // *** non-scheduled scope *** _a=0; while{_a<15000} do{ _a=_a+1; }; hint str(_a);//10000 }; };
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.99
- Scripting Commands OFP 1.96
- Scripting Commands ArmA
- Scripting Commands ArmA2
- Scripting Commands Arma 3
- Scripting Commands Take On Helicopters
- Command Group: Program Flow
 
	