Posted by gatekeepercruelman on Wed, 26 Jan 2011 17:41:14
I'm currently busy with an addon that inspects the gear from players. For now the only time I get the info is when I inspect the player. Can anyone give me a clue how to do that.
Thanks in Advanced.
Posted by jnwhiteh on Wed, 26 Jan 2011 17:46:19
You have to use the API to inspect the unit, wait for the event indicating the information is available. See
Posted by gatekeepercruelman on Wed, 26 Jan 2011 22:26:35
Thanks it's working, I totally oversaw that function. Is there a way to make a pause/wait for 1 sec in an addon?
Posted by jnwhiteh on Wed, 26 Jan 2011 22:40:45
Not really, no. that's not how things work. What are you trying to do that makes you think you need that?
Posted by gatekeepercruelman on Thu, 27 Jan 2011 10:51:34
The reason why is because when I target someone or inspect someone, I don't get all the itemlinks. Sometimes I get like 4 to 6, other times I get 9 to 13 on the first time the when I click on someone. On the second time I get all the info of the items, which probably means my addon works faster then the server gives the information.
I'm using the following code:
for i=1, 18 do iLink = GetInventoryItemLink(unit, i); if(iLink ~= nil)then iLvl = GetItemLevel(iLink); end end
GetItemLevel function is as follow:
function GetItemLevel(iLink) name, link, quality, iLvl, reqLevel, class, subclass, maxStack, equipSlot, texture, vendorPrice = GetItemInfo(iLink); if(iLvl == nil)then ilvl = 0; end return iLvl; end
Posted by jnwhiteh on Thu, 27 Jan 2011 11:42:51
You could use an OnUpdate timer to wait a period of time but that's going to be terribly error prone if potentially many targets could be inspected in a short period of time. What you're trying to do is something that WoW doesn't quite support in an easy to program-for way right now.. anything you do is going to be a hack.. basically.
You might look at ElitistGroup and see how it accomplishes this for ideas of how programs that are written well can still obtain this information.
Posted by gatekeepercruelman on Thu, 27 Jan 2011 14:50:45
I've looked into the (im)famous gearscore addon, they are basically using the same thing. I'll try to find a solution. Thanks for the tips and all.
Posted by jnwhiteh on Thu, 27 Jan 2011 15:17:22
There is a precise reason I suggested ElitistGroup and NOT GearScore. When in doubt, GearScore does it wrong.