I am using this bit of code for certain weakauras to shift down when on CD. Yet i keep running into the "attempt to compare nil with number"error in this bit of code.
Any idea what could cause this ?
Code:
function(progress, startX, startY, deltaX, deltaY)
local ycoord,xcoord
--Choosing what animation to show and determig start time of animation
if aura_env.currState == "cd" then
if aura_env.prevState == "active" then
aura_env.animstart = GetTime()
aura_env.animtype = "hide"
end
aura_env.prevState = "cd"
elseif aura_env.currState == "ready" then
if aura_env.prevState == "cd" then
aura_env.animstart = GetTime()
aura_env.animtype ="show"
end
aura_env.prevState = "ready"
elseif aura_env.currState =="active" then
aura_env.prevState = "active"
end
if aura_env.animstart and GetTime()-aura_env.animstart>aura_env.animDuration then
aura_env.animstart = nil
aura_env.animtype = nil
end
if aura_env.animstart then
local animprogress = (GetTime()-aura_env.animstart)/aura_env.animDuration
if aura_env.animtype== "hide" then
ycoord = animprogress*aura_env.deltaY
xcoord = animprogress*aura_env.deltaX
WeakAuras.regions[aura_env.id].region.stacks:SetPoint("CENTER", WeakAuras.regions[aura_env.id].region.icon,"CENTER",-xcoord,-ycoord) --Moving text relative to icon so that is stays in place
return startX+xcoord, startY+ycoord
elseif aura_env.animtype== "show" then
ycoord =(1-animprogress)*aura_env.deltaY
xcoord =(1-animprogress)*aura_env.deltaX
WeakAuras.regions[aura_env.id].region.stacks:SetPoint("CENTER", WeakAuras.regions[aura_env.id].region.icon,"CENTER",-xcoord,-ycoord) --Moving text relative to icon so that is stays in place
return startX+xcoord, startY+ycoord
end
end
if aura_env.currState == "cd" then
WeakAuras.regions[aura_env.id].region.stacks:SetPoint("CENTER", WeakAuras.regions[aura_env.id].region.icon,"CENTER",-aura_env.deltaX,-aura_env.deltaY)
return startX+aura_env.deltaX, startY+aura_env.deltaY
else
WeakAuras.regions[aura_env.id].region.stacks:SetPoint("CENTER", WeakAuras.regions[aura_env.id].region.icon,"CENTER",0,0)
return startX, startY
end
end
EDIT:
This is the error message Bugsack shows me
79518x [string "return function(progress, startX, startY, d..."]:20: attempt to compare nil with number
[string "return function(progress, startX, startY, d..."]:20: in function `translateFunc'
WeakAuras\WeakAuras-2.2.1.9-3-gcaf1148.lua:2298: in function <WeakAuras\WeakAuras.lua:2242>