View Single Post
04/04/14, 07:31 AM   #5
Cr4x
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 11
As Errc said you can watch EVENT_ACTION_LAYERS_POPPED and _PUSHED for just watching if something is opened.

If you need to access further informations for example when the Inventory is opened:

Lua Code:
  1. MyAddon = {}
  2. MyAddon.InventoryOpened = false
  3.  
  4. function MyAddon.ZOPlayerInventoryOnShow(self, hidden)
  5.     if ( not hidden ) then
  6.         MyAddon.InventoryOpened = true
  7.     end
  8. end
  9.  
  10. function MyAddon.ZOPlayerInventoryOnHide(self, hidden)
  11.     if ( hidden ) then
  12.         MyAddon.InventoryOpened = false
  13.     end
  14. end
  15.  
  16. function MyAddon.OnAddOnLoaded(eventcode, addOnName)
  17.     if (addOnName ~= "MyAddon") then return end
  18.  
  19.     -- ZO_PlayerInventory < ToplevelControl which is shown when pressing "i"
  20.     ZO_PlayerInventory:SetHandler("OnShow", MyAddon.ZOPlayerInventoryOnShow)
  21.     ZO_PlayerInventory:SetHandler("OnShow", MyAddon.ZOPlayerInventoryOnHide)
  22. end
  23.  
  24. EVENT_MANAGER:RegisterForEvent("MyAddon_EVENT_ADD_ON_LOADED", EVENT_ADD_ON_LOADED, MyAddon.OnAddOnLoaded)

Last edited by Cr4x : 04/04/14 at 07:34 AM. Reason: [Indent] not working inside of lua highlight
  Reply With Quote