View Single Post
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