Thread Tools Display Modes
06/24/15, 10:47 AM   #1
DerBombo
 
DerBombo's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 29
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?
  Reply With Quote
06/24/15, 10:55 AM   #2
DerBombo
 
DerBombo's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 29
Damn, I just realized this post is completely misplaced here. Could someone please move it? :S
  Reply With Quote
06/24/15, 11:26 AM   #3
Ayantir
 
Ayantir's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 1,019
Lua Code:
  1. local inventoryScene = SCENE_MANAGER:GetScene("inventory")

instead of New.

then add a little zo_callLater, there is a small delay.
  Reply With Quote
06/24/15, 11:46 AM   #4
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
Originally Posted by DerBombo View Post
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

Last edited by votan : 06/24/15 at 11:47 AM. Reason: Too slow
  Reply With Quote
06/24/15, 12:00 PM   #5
DerBombo
 
DerBombo's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 29
Great! Thanks guys! I will try that out as soon as possible!
  Reply With Quote
06/24/15, 02:53 PM   #6
DerBombo
 
DerBombo's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 29
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!
  Reply With Quote

ESOUI » Developer Discussions » Tutorials & Other Helpful Info » Inventory open event

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off