ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Lua/XML Help (https://www.esoui.com/forums/forumdisplay.php?f=175)
-   -   How to manipulate the bank menu in code? (https://www.esoui.com/forums/showthread.php?t=10427)

SSM24 01/22/23 10:47 PM

How to manipulate the bank menu in code?
 
To be more specific, the feature I want to add is:
  1. Switching to the "Deposit" (player inventory) mode (primarily concerned about keyboard mode)
  2. Opening the Materials tab after this
For #1, I assume this has something to do with fragments, but all I can seem to find on the wiki and forum is how to detect when a fragment change occurs, not how to trigger it on your own in code (if that even is the right approach - there might be some higher-level thing I'm missing).

For #2, it seems to have something to do with ZO_InventoryManager:ChangeFilter, but when I try to use that method from Torchbug for testing, I get the error "Inventory.lua:1276: attempt to index a nil value" which seems to refer to this line (and indeed, when I was checking the value of ZO_InventoryManager.inventories earlier I was getting nil).
EDIT: I figured this one out, you're actually supposed to use PLAYER_INVENTORY instead of ZO_InventoryManager. (Though it's still not changing the "active tab" indicator so I still have a suspicion there's a better way to be doing this.)

Any insight on how I might do these things properly, or if I'm even taking the correct approach to begin with, would be appreciated.

Baertram 01/23/23 04:35 AM

You need to call the code that sets the needed button of the tabs, to switch to deposit, and after that to the materials tab.

Each button got an identifier named descriptor which can be used to switch to that identifier. Here is an example thread about the PROVISIONER crafting table.

https://www.esoui.com/forums/showthr...bar+descriptor

It also describes the ZO_InventoryManager (class) vs PLAYER_INVENTORY (object created from the class) thing,based on the PROVISIONER
object.

You need to change the menu bar to the one of the bank. Use an addon like merTorchbug updated to inspect the control below the cursor (/tbm Slash command) to get the menubar name and the buttons descriptor (is at the data table of the button).
The descriptor should be shown as number but is a SI_ string constant. It's the tabs text normally so you should be able to find it wir merTorchbug Strings by using slash command /tb and switching to the strings tab. Search for the buttons text then and you see the si_ constants. One should be the "Deposit" text VS vs another the "Material".

This will internally call the scene and its fragments. But there isn't 1 Fragment for each button! It's just 1 for deposit and 1 for withdraw.
And activating a fragment manually can result into problems so better use the code that ZOs does too, means the ZO_ActionBar descriptor change.

SSM24 01/23/23 05:25 AM

Yep, this works perfectly:

Code:

ZO_MenuBar_SelectDescriptor(ZO_PlayerBankMenuBar, SI_BANK_DEPOSIT)
ZO_MenuBar_SelectDescriptor(ZO_PlayerInventoryTabs, ITEM_TYPE_DISPLAY_CATEGORY_CRAFTING)

Thank you very much for the help!


All times are GMT -6. The time now is 02:41 PM.

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