Lua events

From ESOUI Wiki

Jump to: navigation, search

Map Zone change

This code will trigger every time the map zone changes:

-- define this outside of function scope to avoid registering it each time OnZoneChanged is ran
local UNITTAG_PLAYER = 'player' 
 
local function OnZoneChanged()
  local zoneName = GetUnitZone(UNITTAG_PLAYER)
  if zoneName:find("NOT_A_VALID_ZONE_NAME") then -- cheapest way to compare strings
    -- do something - this never happens anyway.. :)
  end
end
CALLBACK_MANAGER:RegisterCallback("OnWorldMapChanged", OnZoneChanged)

Please note that UNITTAG_PLAYER will be available in all code below the line defining it in the same file.
The string "NOT_A_VALID_ZONE_NAME" will be registered every time the function OnZoneChanged is called. While that is not happen often, if you were listening to EVENT_COMBAT_EVENT, it might eventually pile up to significant overhead.

Personal tools
Namespaces
Variants
Actions
Menu
Wiki
Toolbox