Thread Tools Display Modes
04/05/14, 07:02 PM   #1
Wukar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 27
ZO_PlayerInventoryBackpack methods

According to my questions about adding an element to a ui, i am now stuck at updating the inventory/bank listing.

lua Code:
  1. local backpack = ZO_PlayerInventoryBackpack
  2. local invBackup = backpack.data
  3.  
  4. local function GetSingularName(name)
  5.     for match in string.gmatch(name, "([^\^]+)") do
  6.         return match
  7.     end
  8.  
  9.     return ""
  10. end
  11.  
  12. local function searchItem(editbox)
  13.     local text = editbox:GetText()
  14.     local filteredBackpack = {}
  15.     local startIndex = 1
  16.  
  17.     for x, row in pairs(invBackup) do
  18.         local bagId = row.data.bagId
  19.         local slotIndex = row.data.slotIndex
  20.         local itemName = GetSingularName(GetItemName(bagId, slotIndex))
  21.  
  22.         if (text == "" or string.match(itemName:lower(), text:lower())) then
  23.             filteredBackpack[startIndex] = row
  24.             startIndex = startIndex + 1
  25.         end
  26.     end
  27.  
  28.     backpack.data = filteredBackpack
  29. end

That does work to some extend. But the inventory list is not updated or redrawn unless i scroll up and down. The scrollbar, however, still remains.

I need some of these not (well) documented miracle function calls, i guess
  Reply With Quote
04/07/14, 06:51 AM   #2
Wukar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 27
One could learn alot on what is possible and have a better overview of available functions.

I wonder if the standard UI is available in lua code?
  Reply With Quote
04/07/14, 07:31 AM   #3
Biki
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 34
It is, but right know you either

1) need to wait until Zenimax allows ESOUI (and other sources) to post it
2) Decompress it out game0000.dat
3) Get it somewhere else
  Reply With Quote
04/07/14, 08:08 AM   #4
ingeniousclown
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 122
You don't need to update constantly, right?

You might attach a handler to that search box that calls the update function for that list. What kind of handler... well I'll leave that up to you.
  Reply With Quote
04/07/14, 09:54 AM   #5
Wukar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 27
:OnTextChanged might be the most suitable for keystrokes.

Update method - interesting
Which update method on what list? Currently not ingame - i remember a data table, containing the currently visible inventory items.
  Reply With Quote
04/07/14, 10:17 AM   #6
ingeniousclown
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 122
Feel free to dig into my InventoryGridView mod and look at how I change the controls from list to grid. Specifically, look at the function that I hook in GridViewController.lua. You should be able to forcibly call GridViewController on ZO_PlayerInventoryBackpack after filtering your data to update the list. That won't fix your scroll bar, though.

I have managed to fix the scroll bar in IGV on my computer at home, but I'm at work right now and don't remember exactly what I did.
  Reply With Quote
04/08/14, 08:33 AM   #7
Wukar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 27
Thanks for the hint. I already was looking into your code but didn't take a too close look at the PreHook. Trying to get some insights from the game.dat now.
  Reply With Quote
04/08/14, 09:51 AM   #8
tiomun
 
tiomun's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 25
I was playing with the inventory earlier. My goal was to move the controls into a wraper that could be moved around. this worked well, but I have some bugs im working out. Heres some of the ZO control children I found that may be of use.



The one I missed in the image is ZO_PlayerInventoryTabs

This was a big help in finding the control names.
http://wiki.esoui.com/Raw_globals_dump

note if your moving some of the existing controls many like to Anchor on the right hand side.

There is also 2 functions ZO_PlayerInventory_Initialize, and ZO_PlayerInventory_Initialized I found interesting but haven't completely figured out yet.

I hope that helps some.

Last edited by tiomun : 04/08/14 at 09:58 AM.
  Reply With Quote
04/08/14, 10:23 AM   #9
ingeniousclown
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 122
Originally Posted by tiomun View Post
I was playing with the inventory earlier. My goal was to move the controls into a wraper that could be moved around. this worked well, but I have some bugs im working out. Heres some of the ZO control children I found that may be of use.



The one I missed in the image is ZO_PlayerInventoryTabs

This was a big help in finding the control names.
http://wiki.esoui.com/Raw_globals_dump

note if your moving some of the existing controls many like to Anchor on the right hand side.

There is also 2 functions ZO_PlayerInventory_Initialize, and ZO_PlayerInventory_Initialized I found interesting but haven't completely figured out yet.

I hope that helps some.
This image is awesome. Great job!
  Reply With Quote
04/08/14, 12:09 PM   #10
tiomun
 
tiomun's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 25
Post

Glad it will be helpful

if your referencing the Raw Globals. The control elements all look to have the same nomenclature to the names, but the raw dump doesn't always list them in a perfectly readable order.

So far I find I'm in the global dumb more than anywhere else.
  Reply With Quote
04/08/14, 12:37 PM   #11
Wukar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 27
From what i found out, there is a ZO_ScrollList_Commit(list) function which calls ZO_ScrollList_UpdateScroll(list) where list is for example ZO_PlayerInventoryBackpack.
Not sure if hidden elements are properly removed.

Things are more complex with guildbank and guildstore, aren't they?
  Reply With Quote
04/08/14, 12:48 PM   #12
ingeniousclown
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 122
Originally Posted by Wukar View Post
From what i found out, there is a ZO_ScrollList_Commit(list) function which calls ZO_ScrollList_UpdateScroll(list) where list is for example ZO_PlayerInventoryBackpack.
Not sure if hidden elements are properly removed.

Things are more complex with guildbank and guildstore, aren't they?
They're only more complex in how they choose the items to display. They all derive from the same zo_scrolltemplate template, so the actual displaying of the data is all the same.

And yes, hidden elements are properly removed. If you look at the parent/child structure in Zgoo, you can see that the list for the inventory maintains a maximum of about 13 items. Each item is given back to the list's objectpool when it is fully hidden and then is grabbed again when a new item needs a spot on the list.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » ZO_PlayerInventoryBackpack methods

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