Thread Tools Display Modes
Prev Previous Post   Next Post Next
05-04-14, 03:36 PM   #1
Mayron
A Frostmaul Preserver
 
Mayron's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 275
Problem with GetItemQualityColor

Hi everyone,

I have a bug which I cannot seem to fix or figure out what is causing it. I have this code:

Lua Code:
  1. local function updateIcons()
  2.     if not PaperDollFrame:IsShown() then return end
  3.    
  4.     for i, slot in next, slots do
  5.         if i == 18 then i = 19 end
  6.         local link = GetInventoryItemLink("player", i)
  7.         local slotName = _G["Character"..slot.."Slot"]
  8.         local iconBorder = _G["mui_" .. "Character" .. slot .. "Slot"]         
  9.        
  10.         if link then
  11.             slotName.icon:SetAlpha(1)
  12.             local r, g, b, _ = GetItemQualityColor(select(3, GetItemInfo(link)))
  13.             iconBorder:SetBackdropBorderColor(r, g, b, 1)
  14.             iconBorder:SetBackdropColor(r,g,b,0.2)         
  15.         end
  16.     end
  17. end

running with this:
Lua Code:
  1. PaperDollFrame:HookScript("OnShow", updateIcons)
  2.     ef:RegisterEvent("UNIT_INVENTORY_CHANGED")
  3.     ef:SetScript("OnEvent", updateIcons)

in a PLAYER_LOGIN event. However this line:
Lua Code:
  1. local r, g, b, _ = GetItemQualityColor(select(3, GetItemInfo(link)))

shows this lua error each time I login:

Code:
Message: Interface\AddOns\MayronUI_Core\Skinning.lua:174: Usage: GetItemQualityColor(index)
Time: 05/04/14 22:10:48
Count: 15
Stack: [C]: ?
[C]: in function `GetItemQualityColor'
Interface\AddOns\MayronUI_Core\Skinning.lua:174: in function <Interface\AddOns\MayronUI_Core\Skinning.lua:163>

Locals:
It is just to get item icons fro mthe character frame and color the border depending on the items rarity value. I am not sure why this is happening because the player has logged in and it does actually work, but I get the error saying I'm using it incorrectly? I'm not sure and hopefully the code makes sense to know what I am trying to do. If anyone has any advice or a fix for me then that would be brilliant but if you need extra information let me know. Thanks in advance guys!


Usage: GetItemQualityColor(index)
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Problem with GetItemQualityColor


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off