publicExec (VBS2)

From Bohemia Interactive Community

Jump to: navigation, search
Editors, please check Policy: Scripting Command Page Syntax.
Introduced in Virtual Battlespace 2 version 1.00

Click on the images for descriptions

Introduced in

Game:
Virtual Battlespace 2
Version:
1.00

Description

Description:
Executes the code on all computers where condition equals true.

Syntax

Syntax:
publicExec [condition, code, object, executeOnThisClient]
Parameters:
condition: String -
code: String -
object: object or Array - (optional)
If specified, the vehicle(s) can be referred to in either condition or code string via "_this" (for a single object) or "_this select n" (where n is the position in the defined array of vehicles).
executeOnThisClient: Boolean - (optional)
Default value is true, so the code is also executed on the current client. When set to false, it will not be executed on the current client.
Return Value:
Nothing

Examples

Example 1:
publicExec ["side player == EAST","player setDammage 1"]
Example 2:
publicExec ["isServer","_this setVelocity [0,0,10]",_veh]

Additional Information

Multiplayer:
Behaviour unknown.

Notes

Notes

+ Add Note

Only post proven facts here. Use the talk page or the forums for discussions.

Notes

Note that you can only pass an object or an array of objects in to the code's _this variable.

If you try to pass a null object, the object will NOT be passed. While this would be an odd thing to do, there could be a situation where a variable turns into a null object unexpectedly, and you then try to pass it into the code.




To "pass" other data types into the code, you need to use the format command to modify the code string. Example:

_num = random 1;
publicExec ["true", format["setOvercast %1", _num]];

You can only pass String, Number, boolean, and side data types in this way.


Bottom Section

Personal tools
Buy ArmA now!