View Single Post
09-02-16, 08:52 AM   #1
ObbleYeah
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Sep 2008
Posts: 210
duplicate conjured items breaking tooltip scanning

hi! i'm currently fiddling with a tooltip scan to cache items in my inventory that give artifact power on use. the function checks the tooltip and then pulls the container id and rewarded amount listed in the tooltip into a function to create a button that can be clicked to use the item.

Lua Code:
  1. for i = 0, 4 do
  2.             for j = 1, GetContainerNumSlots(i) do
  3.                 local item = GetContainerItemLink(i, j)
  4.                 local id   = GetContainerItemID(i, j)
  5.                 if id then
  6.                     tooltip:SetHyperlink(item)
  7.                     local two = _G[tooltip:GetName()..'TextLeft2']
  8.                     if two and two:GetText() then
  9.                         if strmatch(two:GetText(), 'Artifact Power') then
  10.                             local four = _G[tooltip:GetName()..'TextLeft4']:GetText()
  11.                             local ap   = string.match(four, '%d+')
  12.                             if ap then show(id, ap) break end
  13.                         end
  14.                     end
  15.                 end
  16.             end
  17.         end

this works fine, UNTIL i create two separate stacks of conjured items and place them side-by-side in the container (ie. by pressing auto-sort). this will then break tooltip line returns for all items after the first instance of the duplicated item. adding
Code:
print:NumLines()
will just return nil beyond that first duplicated item.

any idea what's causing this?
  Reply With Quote