addPublicVariableEventHandler

From Bohemia Interactive Community

Jump to: navigation, search
Editors, please check Policy: Scripting Command Page Syntax.
Introduced in Armed Assault version 1.09Arguments of this scripting command have to be local to the client the command is executed onEffects of this scripting command are not broadcasted over the network and remain local to the client the command is executed on

Click on the images for descriptions

Introduced in

Game:
Armed Assault
Version:
1.09

Description

Description:
If the EH detects a change via publicVariable on the given variable, code will be executed.

The following arguments are transferred to the code:

_this select 0: variable name

_this select 1: new variable value

Syntax

Syntax:
varName addPublicVariableEventHandler code
Parameters:
varName: String
code: Code
Return Value:
Nothing

Examples

Example 1:
"publicThis" addPublicVariableEventHandler {hint ((_this select 0) + " has been updated to: " + str (_this select 1))}

Additional Information

Multiplayer:
Note that the EH is only fired on clients where the publicVariable command has not been executed, as publicVariable does not change the variable where it has been executed.
See also:
publicVariable

Notes

Notes

+ Add Note

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

Notes

TeRp
Please note that varName indicates which variable you want to monitor with this eventhandler.
As a result, the example eventhandler on this page will only fire when the variable publicThis has been changed, but not if any other variable was changed by any other client via the publicVariable command.

Anunnaki
Very important ! addPublicVariableEventHandler does NOT WORK on dedicated server or player server! This is probaly bug in 1.09beta.

Bottom Section

Personal tools
Buy ArmA now!