publicExec (VBS2)
From Bohemia Interactive Community
| Editors, please check Policy: Scripting Command Page Syntax. |
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
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.

