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

Introduced in



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:varName addPublicVariableEventHandler code
  • varName: String - Variable name.
  • code: Code - Code to execute.
Return Value:Nothing


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.


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.