Quantcast
How to detect map change
Lua Code:
  1. --fire callback when map is changed
  2. ZO_WorldMap_AddCustomPin("Hack_to_detect_map_change",
  3.    function()
  4.       local mapName = select(3,(GetMapTileTexture()):lower():find("maps/([%w%-]+/[%w%-]+_%w+)"))
  5.       CALLBACK_MANAGER:FireCallbacks("My_MapChanged_Callback", mapName)
  6.    end)
  7. ZO_WorldMap_SetCustomPinEnabled(_G["Hack_to_detect_map_change"], true)
  8.      
  9. --register to do stuff when map is changed
  10. CALLBACK_MANAGER:RegisterCallback("My_MapChanged_Callback",
  11.    function(mapName)
  12.       d(mapName)
  13.    end)