Index

:_UICallback

Description

“:_UICallback” is invoked whenever a control panel UI element is changed. The control panel UI elements for a unit are part of its UI definitions in the CMod settings. Whenever a UI element is changed by the player, any script on the unit with :_UICallback (note the underscore) will have the function called.

There is an implicit variable named “_DATA” that is available for use when the callback is made. For this callback, _DATA is an int that points to the UI slot that was changed. 0 refers to the first slot, 1 the 2nd, etc.

See: GetUnitUIState for further information

Example

#:_UICALLBACK is called on any script (if present) whenever a UI widget is changed.
:_UICALLBACK
   #The _DATA is an int that points to the slot that was just changed
   GetUnitUIState(self <-_DATA) ->slotState
   printallsp("UICALLBACK: " <-slotState)