Interface\AddOns\DrunkardSK\DrunkardSK.lua:1313: in function `SetOpenItem'
Interface\AddOns\DrunkardSK\DrunkardSK.lua:1339: in function `?'
...oot\Libs\CallbackHandler-1.0\CallbackHandler-1.0.lua:146: in function <...oot\Libs\CallbackHandler-1.0\CallbackHandler-1.0.lua:146>
[string "safecall Dispatcher[4]"]:4: in function <[string "safecall Dispatcher[4]"]:4>
[C]: ?
[string "safecall Dispatcher[4]"]:13: in function `?'
...oot\Libs\CallbackHandler-1.0\CallbackHandler-1.0.lua:91: in function `Fire'
...ce\AddOns\AtlasLoot\Libs\AceComm-3.0\AceComm-3.0.lua:268: in function <...ce\AddOns\AtlasLoot\Libs\AceComm-3.0\AceComm-3.0.lua:257>
Locals: <none>
And here is the relevant code...
function DrunkardSK:SetOpenItem(item)
local n, l, quality, iL, reqL, t, subT, maxS, equipS, texture = GetItemInfo(item)
DSKBidFrame.link:AddMessage(item);
SetItemButtonTexture(DSKBidFrame.item, texture);
r, g, b, hex = GetItemQualityColor(quality); -- this is line 1313
SetItemButtonNormalTextureVertexColor(DSKBidFrame.item, r, g, b);
end
function DrunkardSK:OpenBidding(prefix, message, distribution, sender)
ItemLink = message;
DrunkardSK:SetOpenItem(ItemLink); -- this is line 1339
DSKBidFrame:Show();
end
basic description
A message is received via acecomm. The message contains an item link. The error seems to occur when getting the quality color of that item. It does not occur every time. It is rather infrequent in fact.
The only thing I can think of is to check it for an error, but this message goes out to multiple people and it is only one of them (not always the same one) that gets it.
That error most likely occurs because the client receiving the message has not seen that specific item yet. If the client has to query the server for the item information then the returns from GetItemInfo() are nil since that client function returns before the server can respond to the query.
You'll have to find some way to query and delay processing until the local client knows about the item.
You are calling "GetItemInfo(item)" but is item an itemLink, itemName, itemID, or itemString? If it is an itemLink I'd suggest just parsing the link string for the information you need rather than using GetItemInfo() because, as has already been said, GetItemInfo() will return nil if the item is not in the player's cache.
Regex (although possibly out dated) for getting info out of the itemLink and more info about itemLinks can be found here: http://www.wowpedia.org/ItemLink
They would have to click on it. You can see this in effect for the default UI after a patch (since the cache is automatically wiped after a patch). When you click on a chat link, the tooltip will usually read "Retreiving item information..." for a second or two before the actual tooltip appears.
If you just need to know the item quality, you can just parse the item link in chat and match the link color.
First, define a table and populate it with a color-to-quality mapping:
local colorToQuality = {}
for i = 1, 7 do
colorToQuality[(select(4, GetItemQualityColor(i)))] = i
end
Then, parse your link and check the color against the table:
local color = itemLink:match("|cff(%x%x%x%x%x%x)")
if color then
local quality = colorToQuality[color:lower()]
if quality then
-- do stuff
end
end
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Message: Interface\AddOns\DrunkardSK\DrunkardSK.lua:1313: Usage: GetItemQualityColor(index)
Time: 11/07/10 19:36:35
Count: 1
Stack: [C]: in function `GetItemQualityColor'
Interface\AddOns\DrunkardSK\DrunkardSK.lua:1313: in function `SetOpenItem'
Interface\AddOns\DrunkardSK\DrunkardSK.lua:1339: in function `?'
...oot\Libs\CallbackHandler-1.0\CallbackHandler-1.0.lua:146: in function <...oot\Libs\CallbackHandler-1.0\CallbackHandler-1.0.lua:146>
[string "safecall Dispatcher[4]"]:4: in function <[string "safecall Dispatcher[4]"]:4>
[C]: ?
[string "safecall Dispatcher[4]"]:13: in function `?'
...oot\Libs\CallbackHandler-1.0\CallbackHandler-1.0.lua:91: in function `Fire'
...ce\AddOns\AtlasLoot\Libs\AceComm-3.0\AceComm-3.0.lua:268: in function <...ce\AddOns\AtlasLoot\Libs\AceComm-3.0\AceComm-3.0.lua:257>
Locals: <none>
And here is the relevant code...
function DrunkardSK:SetOpenItem(item)
local n, l, quality, iL, reqL, t, subT, maxS, equipS, texture = GetItemInfo(item)
DSKBidFrame.link:AddMessage(item);
SetItemButtonTexture(DSKBidFrame.item, texture);
r, g, b, hex = GetItemQualityColor(quality); -- this is line 1313
SetItemButtonNormalTextureVertexColor(DSKBidFrame.item, r, g, b);
end
function DrunkardSK:OpenBidding(prefix, message, distribution, sender)
ItemLink = message;
DrunkardSK:SetOpenItem(ItemLink); -- this is line 1339
DSKBidFrame:Show();
end
basic description
A message is received via acecomm. The message contains an item link. The error seems to occur when getting the quality color of that item. It does not occur every time. It is rather infrequent in fact.
The only thing I can think of is to check it for an error, but this message goes out to multiple people and it is only one of them (not always the same one) that gets it.
Any help would be awesome. Many thanks!
You'll have to find some way to query and delay processing until the local client knows about the item.
More info about the limitations of GetItemInfo:
http://www.wowpedia.org/Talk:API_GetItemInfo
Regex (although possibly out dated) for getting info out of the itemLink and more info about itemLinks can be found here:
http://www.wowpedia.org/ItemLink
If you just need to know the item quality, you can just parse the item link in chat and match the link color.
First, define a table and populate it with a color-to-quality mapping:
Then, parse your link and check the color against the table: