ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Tutorials & Other Helpful Info (https://www.esoui.com/forums/forumdisplay.php?f=172)
-   -   Inventory open event (https://www.esoui.com/forums/showthread.php?t=4829)

DerBombo 06/24/15 10:47 AM

Inventory open event
 
Hey everyone!

I'd like to add a keybind button to the keybind strip, when the player has opened the inventory. I got everything working, except for actually adding to the keybind strip in the right moment. Seems like there is no official INVENTORY_OPEN event or something. I tried around a bit but to no avail.

At the moment I'm looking into scenes, hooking up a StateChange callback on the inventory scene itself. My callback is firing correctly, but the result is the inventory not really being shown at all. Other UI elements are hidden successfully but the actual inventory UI is not displayed.

Code:

local inventoryScene = ZO_Scene:New("inventory", SCENE_MANAGER)
inventoryScene:RegisterCallback("StateChange", function(oldState, newState)
    d(newState)
end)

Can anyone help me here getting on the right track?

DerBombo 06/24/15 10:55 AM

Damn, I just realized this post is completely misplaced here. Could someone please move it? :S

Ayantir 06/24/15 11:26 AM

Lua Code:
  1. local inventoryScene = SCENE_MANAGER:GetScene("inventory")

instead of New.

then add a little zo_callLater, there is a small delay.

votan 06/24/15 11:46 AM

Quote:

Originally Posted by DerBombo (Post 21717)
My callback is firing correctly, but the result is the inventory not really being shown at all. Other UI elements are hidden successfully but the actual inventory UI is not displayed.

Code:

local inventoryScene = ZO_Scene:New("inventory", SCENE_MANAGER)
inventoryScene:RegisterCallback("StateChange", function(oldState, newState)
    d(newState)
end)

Can anyone help me here getting on the right track?

I think it should be:
Code:

local inventoryScene = SCENE_MANAGER:GetScene("inventory")
inventoryScene:RegisterCallback("StateChange", function(oldState, newState)
    d(newState)
end)

Edit 1:
Ayantir was faster :D

DerBombo 06/24/15 12:00 PM

Great! Thanks guys! I will try that out as soon as possible!

DerBombo 06/24/15 02:53 PM

Works like a charm (of course)! Thanks guys!

I've added zo_callLater with 100ms delay, although I tested it without any delay also, which did not cause any immediate problems. Do you have some experience there justifiying the delay? I guess omitting the delay can cause some timing issues?

That's just out of curiosity, though. Finally I can ship a new version! :)


All times are GMT -6. The time now is 01:32 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI