Quantcast
WoWInterface - View Single Post - Event for switching talents?
View Single Post
08-09-17, 09:52 PM   #12
Galaxy119
A Flamescale Wyrmkin
 
Galaxy119's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2014
Posts: 111
So I thought I had already, and upon updating I realize why I thought I did and why I hadn't.

I did previously attempt to update the oUF version being used, but upon doing so I am hit with this error that pretty much completely breaks my entire oUF layout, and I could never figure out how to fix it;
Code:
Message: Interface\AddOns\Roth_UI\units\player.lua:305: attempt to compare number with nil
Time: 08/09/17 20:50:05
Count: 1
Stack: Interface\AddOns\Roth_UI\units\player.lua:305: attempt to compare number with nilInterface\SharedXML\SharedBasicControls.lua:204: in function <Interface\SharedXML\SharedBasicControls.lua:203>
[C]: ?
Interface\AddOns\Roth_UI\units\player.lua:305: in function <Interface\AddOns\Roth_UI\units\player.lua:303>
(tail call): ?
(tail call): ?
Interface\AddOns\Roth_UI\embeds\oUF\ouf.lua:198: in function <Interface\AddOns\Roth_UI\embeds\oUF\ouf.lua:187>
(tail call): ?

Locals: errorMessage = "Interface\AddOns\Roth_UI\units\player.lua:305: attempt to compare number with nil"
DisplayMessageInternal = <function> defined @Interface\SharedXML\SharedBasicControls.lua:187
MESSAGE_TYPE_ERROR = 0

The offending function (4th line down is the one that causes the error):
Lua Code:
  1. --post update orb func (used to display lowHp on percentage)
  2.   local updateValue = function(bar, unit, cur, max)
  3.     local per = 0
  4.     if max > 0 then per = floor(cur/max*100) end
  5.     local orb = bar:GetParent()
  6.     local self = orb:GetParent()
  7.     --if orb.type == "HEALTH" and  (per <= 25 and not UnitIsDeadOrGhost(unit)) then
  8.     if orb.type == "HEALTH" and  (per <= 25 or UnitIsDeadOrGhost(unit)) then
  9.       orb.lowHP:Show()
  10.     elseif orb.type == "HEALTH" then
  11.       orb.lowHP:Hide()
  12.     end
  13.     if orb.type == "HEALTH" and UnitIsDeadOrGhost(unit) then
  14.       orb.skull:Show()
  15.     elseif orb.type == "HEALTH" then
  16.       orb.skull:Hide()
  17.     end
  18.     if db.char[orb.type].value.hideOnEmpty and (UnitIsDeadOrGhost(unit) or cur < 1) then
  19.       orb.values:Hide()
  20.     elseif db.char[orb.type].value.hideOnFull and (cur == max) then
  21.       orb.values:Hide()
  22.     elseif not orb.values:IsShown() then
  23.       orb.values:Show()
  24.     end
  25.     if orb.type == "HEALTH" then
  26.       orb.values.top:SetText(oUF.Tags.Methods["diablo:HealthOrbTop"](self.unit or "player"))
  27.       orb.values.bottom:SetText(oUF.Tags.Methods["diablo:HealthOrbBottom"](self.unit or "player"))
  28.     elseif orb.type == "POWER" then
  29.       orb.values.top:SetText(oUF.Tags.Methods["diablo:PowerOrbTop"](self.unit or "player"))
  30.       orb.values.bottom:SetText(oUF.Tags.Methods["diablo:PowerOrbBottom"](self.unit or "player"))
  31.     end
  32.     if UnitIsDeadOrGhost(unit) then
  33.       bar:SetValue(0)
  34.     end
  35.     if ns.panel:IsShown() then
  36.       ns.panel.eventHelper:SetOrbsToMax()
  37.     end
  38.   end --post update orb func (used to display lowHp on percentage)
  39.   local updateValue = function(bar, unit, cur, max)
  40.     local per = 0
  41.     if max > 0 then per = floor(cur/max*100) end
  42.     local orb = bar:GetParent()
  43.     local self = orb:GetParent()
  44.     --if orb.type == "HEALTH" and  (per <= 25 and not UnitIsDeadOrGhost(unit)) then
  45.     if orb.type == "HEALTH" and  (per <= 25 or UnitIsDeadOrGhost(unit)) then
  46.       orb.lowHP:Show()
  47.     elseif orb.type == "HEALTH" then
  48.       orb.lowHP:Hide()
  49.     end
  50.     if orb.type == "HEALTH" and UnitIsDeadOrGhost(unit) then
  51.       orb.skull:Show()
  52.     elseif orb.type == "HEALTH" then
  53.       orb.skull:Hide()
  54.     end
  55.     if db.char[orb.type].value.hideOnEmpty and (UnitIsDeadOrGhost(unit) or cur < 1) then
  56.       orb.values:Hide()
  57.     elseif db.char[orb.type].value.hideOnFull and (cur == max) then
  58.       orb.values:Hide()
  59.     elseif not orb.values:IsShown() then
  60.       orb.values:Show()
  61.     end
  62.     if orb.type == "HEALTH" then
  63.       orb.values.top:SetText(oUF.Tags.Methods["diablo:HealthOrbTop"](self.unit or "player"))
  64.       orb.values.bottom:SetText(oUF.Tags.Methods["diablo:HealthOrbBottom"](self.unit or "player"))
  65.     elseif orb.type == "POWER" then
  66.       orb.values.top:SetText(oUF.Tags.Methods["diablo:PowerOrbTop"](self.unit or "player"))
  67.       orb.values.bottom:SetText(oUF.Tags.Methods["diablo:PowerOrbBottom"](self.unit or "player"))
  68.     end
  69.     if UnitIsDeadOrGhost(unit) then
  70.       bar:SetValue(0)
  71.     end
  72.     if ns.panel:IsShown() then
  73.       ns.panel.eventHelper:SetOrbsToMax()
  74.     end
  75.   end
__________________
My Addons | "If someone says something is impossible, they either lack imagination, or lack determination."
  Reply With Quote