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

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


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