Originally Posted by Phanx
You're (probably) getting those errors because you don't currently have the buff active. I guess WeakAuras can't handle nil values itself (I don't actually use it) so just return a zero if UnitAura didn't return anything:
Code:
function()
local _, _, _, _, _, duration, expirationTime = UnitBuff("player", "Blutschild")
return expirationTime or 0
end
or:
Code:
function()
local _, _, _, _, _, duration, expirationTime = UnitBuff("player", "Blutschild")
return expirationTime and (expirationTime - GetTime()) or 0
end
Again, as I don't actually use WeakAuras, I don't know whether it needs the remaining time or the expiration time, but either of the above should make sure it doesn't receive any scary nil values.
|
It is still complaining about the fact that expirationTime is nil while the Blood Shield Buff isnt up.
This time ill post the whole error output:
132x Interface\AddOns\WeakAuras\RegionTypes\aurabar.lua:649: attempt to perform arithmetic on field 'expirationTime' (a nil value)
Interface\AddOns\WeakAuras\RegionTypes\aurabar.lua:649: in function <Interface\AddOns\WeakAuras\RegionTypes\aurabar.lua:647>
Interface\AddOns\WeakAuras\RegionTypes\aurabar.lua:1053: in function `SetDurationInfo'
Interface\AddOns\WeakAuras\WeakAuras-2.0.7.lua:1875: in function `SetEventDynamics'
Interface\AddOns\WeakAuras\WeakAuras-2.0.7.lua:1835: in function `ActivateEvent'
Interface\AddOns\WeakAuras\WeakAuras-2.0.7.lua:1816: in function `ScanEvents'
Interface\AddOns\WeakAuras\WeakAuras-2.0.7.lua:1730: in function `ForceEvents'
Interface\AddOns\WeakAuras\WeakAuras-2.0.7.lua:2144: in function `ScanForLoads'
...terface\AddOns\WeakAurasOptions\WeakAurasOptions-2.0.7.lua:8128: in function <...terface\AddOns\WeakAurasOptions\WeakAurasOptions.lua:8127>
Locals:
self = <unnamed> {
0 = <userdata>
values = <table> {
}
UpdateCustomText = <function> defined @Interface\AddOns\WeakAuras\RegionTypes\aurabar.lua:905
Color = <function> defined @Interface\AddOns\WeakAuras\RegionTypes\aurabar.lua:783
duration = 0
border = <unnamed> {
}
SetDurationInfo = <function> defined @Interface\AddOns\WeakAuras\RegionTypes\aurabar.lua:1012
stacks = <unnamed> {
}
SetIcon = <function> defined @Interface\AddOns\WeakAuras\RegionTypes\aurabar.lua:834
SetStacks = <function> defined @Interface\AddOns\WeakAuras\RegionTypes\aurabar.lua:928
trigger_count = 0
icon = <unnamed> {
}
color_g = 0
Scale = <function> defined @Interface\AddOns\WeakAuras\RegionTypes\aurabar.lua:942
Expand = <function> defined @Interface\AddOns\WeakAuras\WeakAuras.lua:3710
color_b = 0.058823529411765
text = <unnamed> {
}
GetColor = <function> defined @Interface\AddOns\WeakAuras\RegionTypes\aurabar.lua:790
color_r = 1
triggers = <table> {
}
iconFrame = <unnamed> {
}
SetName = <function> defined @Interface\AddOns\WeakAuras\RegionTypes\aurabar.lua:1005
Collapse = <function> defined @Interface\AddOns\WeakAuras\WeakAuras.lua:3698
timer = <unnamed> {
}
color_a = 1
orientation = "HORIZONTAL"
bar = <unnamed> {
}
}
duration = 0
expirationTime = nil
customValue = nil
inverse = nil
data = <table> {
textFlags = "None"
stacksSize = 24
borderBackdrop = "Blizzard Tooltip"
xOffset = 0
parent = "DK Group"
stacksFlags = "None"
customText = "function ()
local max_health = UnitHealthMax("player");
return math.floor(max_health/1000);
end"
yOffset = 60
anchorPoint = "CENTER"
untrigger = <table> {
}
color = <table> {
}
borderColor = <table> {
}
customTextUpdate = "update"
rotateText = "NONE"
icon = true
fontFlags = "OUTLINE"
actions = <table> {
}
displayTextLeft = "%sk"
numTriggers = 1
selfPoint = "CENTER"
trigger = <table> {
}
text = true
barColor = <table> {
}
stickyDuration = false
desaturate = false
backgroundColor = <table> {
}
barInFront = true
alpha = 1
timer = true
timerFlags = "None"
load = <table> {
}
height = 26.999997118166
backdropColor = <table> {
}
id = "Blood Shield"
displayStacks = "%s"
timerColor = <table> {
}
zoom = 0
displayTextRight = "%ck"
border = false
borderEdge = "None"
regionType = "aurabar"
stacks = false
stacksFont = "Friz Quadrata TT"
icon_side = "LEFT"
stacksContainment = "INSIDE"
stacksColor = <table> {
}
borderSize = 16
texture = "Flat"
textFont = "Friz Quadrata TT"
borderOffset = 5
auto = false
timerSize = 18
additional_triggers = <table> {
}
timerFont = "Friz Quadrata TT"
frameStrata = 1
width = 150
animation = <table> {
}
borderInset = 11
inverse = false
textSize = 18
orientation = "HORIZONTAL"
displayIcon = "Interface\Icons\Spell_DeathKnight_Butcher2"
stacksPoint = "BOTTOMRIGHT"
textColor = <table> {
}
}
UpdateValue = <function> defined @Interface\AddOns\WeakAuras\RegionTypes\aurabar.lua:700
UpdateTimeInverse = <function> defined @Interface\AddOns\WeakAuras\RegionTypes\aurabar.lua:694
UpdateTime = <function> defined @Interface\AddOns\WeakAuras\RegionTypes\aurabar.lua:647
bar = <unnamed> {
OnSizeChanged = <function> defined @Interface\AddOns\WeakAuras\RegionTypes\aurabar.lua:159
GetBackgroundColor = <function> defined @Interface\AddOns\WeakAuras\RegionTypes\aurabar.lua:244
GetVertexColor = <function> defined @Interface\AddOns\WeakAuras\RegionTypes\aurabar.lua:258
Update = <function> defined @Interface\AddOns\WeakAuras\RegionTypes\aurabar.lua:57
GetOrientation = <function> defined @Interface\AddOns\WeakAuras\RegionTypes\aurabar.lua:207
SetVertexColor = <function> defined @Interface\AddOns\WeakAuras\RegionTypes\aurabar.lua:255
fg = <unnamed> {
}
SetOrientation = <function> defined @Interface\AddOns\WeakAuras\RegionTypes\aurabar.lua:196
value = 1
SetMinMaxValues = <function> defined @Interface\AddOns\WeakAuras\RegionTypes\aurabar.lua:164
bg = <unnamed> {
}
GetForegroundColor = <function> defined @Interface\AddOns\WeakAuras\RegionTypes\aurabar.lua:236
GetMinMaxValues = <function> defined
|
Even after i active the Blood Shield the errors arent disappearing. It is defenitely related to the duration
i want to show because if i delete it everything just works fine.