remoteExecCall: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (Text replacement - "{{HashLink" to "{{Link")
 
(149 intermediate revisions by 16 users not shown)
Line 1: Line 1:
[[Category:Scripting_Commands_Arma_3]]
{{RV|type=command
[[Category:Arma_3:_New_Scripting_Commands_List]]
[[Category:Broken Scripting Commands|{{uc:{{PAGENAME}}}}]]
{{Command|= Comments
____________________________________________________________________________________________


| arma3dev |= Game name
|game1= arma3
|1.46|= Game version
|version1= 1.50


____________________________________________________________________________________________
|gr1= Multiplayer


| Asks server to execute a command remotely by [[call]]ing it.
|descr= [[Scheduler|Unscheduled]] version of [[remoteExec]]. The only difference between [[remoteExec]] and [[remoteExecCall]] is that [[remoteExecCall]] will run '''functions''' in [[Scheduler#Unscheduled Environment|unscheduled environment]].
{{warning | Doesn't execute function on server}} |= Description
{{Feature|important|
____________________________________________________________________________________________
The "Call" in [[remoteExecCall]] only means that the remote execution will take place in [[Scheduler#Unscheduled Environment|unscheduled environment]] and does '''not''' mean it will happen right away (see {{Link|#Example 3}}).}}


| params [[remoteExecCall]] [functionName, targets, JIP] |= Syntax
|s1= see [[remoteExec]]


|p1= see [[remoteExec]]


|p1= '''params''' (Optional): [[Anything]] - parameters passed to the function|=
|r1= see [[remoteExec]]
|p2= [functionName, targets, JIP]: - [[Array]]|=
|p3= '''functionName''': [[String]] - function name or command name. While any function can be used, only commands defined in ''[[CfgRemoteExecCommands]]'' are supported. |=
|p4= '''target''' (Optional): [default: 0]
: [[Number]] - the function will be executed only on client with the given [[owner]] ID. When 0, the function will be executed on each client including the one where [[remoteExecCall]] was originated from. When 2, it will be executed by server only.  When negative ids are supplied, PCs with matching ids will be excluded from the list.
: [[Object]] - function will be executed only where unit is local.
: [[Side]] - the function will be executed only on clients where the player is on the specified side.
: [[Group]] - the function will be executed only on clients where the player is in the specified group.
: [[Array]] - array of any of types listed above.
|=
|p5= ''' JIP''' (Optional): [[String]] or [[Boolean]] - If [[true]], function generates a unique ID for the message and the message itself is added to the JIP queue and executed for every JIP. If a non-empty string is given, it is treated a custom ID of the message and the message itself is added to the JIP queue overriding any [[remoteExecCall]] message with the same ID. Otherwise, no ID is generated and no message is placed into the JIP queue. [default: false] |=


| [[String]] or [[Nothing]] - In case of error [[nil]] is returned, otherwise [[String]]. If JIP is not requested this is an empty [[String]]. Otherwise this is an unique JIP ID. See the topic [[Function#Return_Values|Function]] for more information. |= Return value
|x1= <sqf>["hello"] remoteExec ["hint"]; // runs unscheduled
____________________________________________________________________________________________
["hello"] remoteExecCall ["hint"]; // no difference at all</sqf>
 
|x1= <code>"hello" [[remoteExecCall]] ["hint"]; // runs hint "hello" on each connected client </code> |=
|x2= <code>"hello" [[remoteExecCall]] ["hint", 0]; // runs hint "hello" on each connected client </code> |=
|x3= <code>"hello" [[remoteExecCall]] ["hint", 3]; // runs hint "hello" on first connected client </code> |=
|x4= <code>"hello" [[remoteExecCall]] ["hint", -2]; // runs hint "hello" everywhere but server </code> |=
|x5= <code>myJipID = "hello" [[remoteExecCall]] ["hint", -2, "IamUnique"];
// runs hint "hello" everywhere but server, JIPs the message and return e.g. "3_1" as a unique JIP id </code> |=
|x6= <code>[[remoteExecCall]] ["someFuncWithNoArgs"];
// runs "someFuncWithNoArgs" on each connected client </code> |=
|x7= <code>[[remoteExecCall]] ["", "IamUnique"];
// removes the message identified by "IamUnique" ID from the JIP queue.
// Therefore, for newly connected clients hint "hello" won't be displayed anymore </code> |=
|x8= <code>{player setAmmo [primaryWeapon player, 1];} [[remoteExecCall]] ["bis_fnc_call", 0];
// all clients will have their ammo set to 1 for their current weapon </code> |=
|x9= <code>myJipID = "hello" [[remoteExecCall]] ["", 0];
if (isNil "myJipID") then { hint "empty function name is not allowed"; }; </code> |=


____________________________________________________________________________________________
|x2= <sqf>["my message"] remoteExec ["BIS_fnc_infoText"]; // correct
["my message"] remoteExecCall ["BIS_fnc_infoText"]; // wrong - BIS_fnc_infoText needs a scheduled environment, see its spawn need</sqf>


| [[remoteExec]], [[BIS_fnc_MP]] |= See also
|x3= <sqf>remoteExecCall ["fnc1"];
call fnc2; // fnc1 may or may not be executed after fnc2


call fnc1;
call fnc2; // fnc2 will be executed after fnc1</sqf>
|seealso= [[remoteExec]] [[remoteExecutedOwner]] [[isRemoteExecuted]] [[isRemoteExecutedJIP]] [[Arma 3: Remote Execution]] [[canSuspend]] [[BIS_fnc_MP]]
}}
}}


<!-- CONTINUE Notes -->


<!-- DISCONTINUE Notes -->
{{GameCategory|arma3|Remote Execution}}

Latest revision as of 18:43, 4 January 2023

Hover & click on the images for description

Description

Description:
Unscheduled version of remoteExec. The only difference between remoteExec and remoteExecCall is that remoteExecCall will run functions in unscheduled environment.
The "Call" in remoteExecCall only means that the remote execution will take place in unscheduled environment and does not mean it will happen right away (see Example 3).
Groups:
Multiplayer

Syntax

Syntax:
see remoteExec
Parameters:
see remoteExec
Return Value:
see remoteExec

Examples

Example 1:
["hello"] remoteExec ["hint"]; // runs unscheduled ["hello"] remoteExecCall ["hint"]; // no difference at all
Example 2:
["my message"] remoteExec ["BIS_fnc_infoText"]; // correct ["my message"] remoteExecCall ["BIS_fnc_infoText"]; // wrong - BIS_fnc_infoText needs a scheduled environment, see its spawn need
Example 3:
remoteExecCall ["fnc1"]; call fnc2; // fnc1 may or may not be executed after fnc2 call fnc1; call fnc2; // fnc2 will be executed after fnc1

Additional Information

See also:
remoteExec remoteExecutedOwner isRemoteExecuted isRemoteExecutedJIP Arma 3: Remote Execution canSuspend BIS_fnc_MP

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