Thread Tools Display Modes
Prev Previous Post   Next Post Next
07-29-16, 03:22 PM   #1
Joker119
A Flamescale Wyrmkin
 
Joker119's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2014
Posts: 113
Addon creating SoulShard Bar

I had an addon creating a SoulShard bar fro Afflic locks pre-7.0

I have updated it so that is shows and (seems) to work without issue for all Lock specs, however.. I get this error:
Code:
Message: ...terface\AddOns\oUF_Diablo\modules\oUF_SoulShards.lua:49: attempt to index local 'orb' (a nil value)
Time: 07/29/16 14:12:44
Count: 3
Stack: ...terface\AddOns\oUF_Diablo\modules\oUF_SoulShards.lua:49: in function <...terface\AddOns\oUF_Diablo\modules\oUF_SoulShards.lua:11>
(tail call): ?
(tail call): ?
...terface\AddOns\oUF_Diablo\modules\oUF_SoulShards.lua:67: in function <...terface\AddOns\oUF_Diablo\modules\oUF_SoulShards.lua:57>
(tail call): ?
The function in which it refers to is:
Lua Code:
  1. local Update = function(self, event, unit, powerType)
  2.   local bar = self.SoulShardPowerBar
  3.   local cur = UnitPower(unit, SPELL_POWER_SOUL_SHARDS)
  4.   local max = UnitPowerMax(unit, SPELL_POWER_SOUL_SHARDS)
  5.   --[[ --do not hide the bar when the value is empty, keep it visible
  6.   if cur < 1 then
  7.     if bar:IsShown() then bar:Hide() end
  8.     return
  9.   else
  10.     if not bar:IsShown() then bar:Show() end
  11.   end
  12.   ]]
  13.   --adjust the width of the soulshard power frame
  14.   local w = 64*(max+1)
  15.   bar:SetWidth(w)
  16.   for i = 1, bar.maxOrbs do
  17.     local orb = self.SoulShards[i]
  18.     if i > max then
  19.        if orb:IsShown() then orb:Hide() end
  20.     else
  21.       if not orb:IsShown() then orb:Show() end
  22.     end
  23.   end
  24.   for i = 1, max do
  25.     local orb = self.SoulShards[i]
  26.     local full = cur/max
  27.     if(i <= cur) then
  28.       if full == 1 then
  29.         orb.fill:SetVertexColor(1,0,0)
  30.         orb.glow:SetVertexColor(1,0,0)
  31.       else
  32.         orb.fill:SetVertexColor(bar.color.r,bar.color.g,bar.color.b)
  33.         orb.glow:SetVertexColor(bar.color.r,bar.color.g,bar.color.b)
  34.       end
  35.       orb.fill:Show()
  36.       orb.glow:Show()
  37.       orb.highlight:Show()
  38.     else
  39.       orb.fill:Hide()
  40.       orb.glow:Hide()
  41.       orb.highlight:Hide()
  42.     end
  43.   end

Line 49 being the "orb.fill:Hide()" line in the else condition at the end. Commenting out that leads me to line 50, then 51.
Commenting all 3 of those out removes the error, however it breaks the addon.

With the lines commented out, the soul shards are added to the bar as they are built, but are not removed when consumed.
Not commented out, the soul shards are removed from the bar as expected, but I am spammed with this error countless times while in combat.

Since it's returning with an error, it is also affecting other aspects of the UI addon I have built this into, so leaving the lines and ignoring the errors is not really an option.
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Addon creating SoulShard Bar


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