I thought I had posted this before but I didn't see it show up?
I am writing an addon that will need to scan the users backpack and get back the name and index of the trophy (and then eventually) it will do the same with costumes.
This is the code - it works - but it just gives me (what looks like) the first 20 items in the backpack.
What am I missing here - I know it's got to be something simple.
Lua Code:
function RandomTrophy.trophies()
local backpackItem
local backpackSlots = GetBagSize and GetBagSize(bag) or select(2, GetBagInfo(bag))
for i=1, backpackSlots do
backpackItem = GetItemLink(BAG_BACKPACK, i, LINK_ITEM_TYPE)
if string.match(backpackItem, COLLECTIBLE_ITEM_TYPE_TROPHY) then
d(i)
d(backpackItem)
end
end
end
Any help greatly appreciated !
Thanks,
-d