Page tree
Skip to end of metadata
Go to start of metadata


Introduced in

Version:1.00

Description

Description:If the event handler detects a change using publicVariable on the given variable, the code executes.

The following parameters are transferred to the code:

  • _this select 0: variable name.
  • _this select 1: new variable value.

Syntax

Syntax:varName addPublicVariableEventHandler code
Parameters:
  • varName: String - Variable name.
  • code: Code - Code to execute.
Return Value:Nothing

Examples

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

Additional Information

See also: publicVariable
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.
Problems: 

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.