Thread Tools Display Modes
01/22/23, 10:47 PM   #1
SSM24
 
SSM24's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2023
Posts: 3
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.

Last edited by SSM24 : 01/23/23 at 03:38 AM.
  Reply With Quote
01/23/23, 04:35 AM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,913
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.

Last edited by Baertram : 01/23/23 at 04:42 AM.
  Reply With Quote
01/23/23, 05:25 AM   #3
SSM24
 
SSM24's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2023
Posts: 3
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!
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » How to manipulate the bank menu in code?

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