Doesn't help much :/
Changed the code to:
Code:
local expirationTime, _, _, _, name = ...
local destName = name or "nil"
local subIndex = string.find(destName, "-")
local printName = "nil"
local distanceSquared = select(1,UnitDistanceSquared(destName)) -- Get distance of unit the aura triggered from
local distance = distanceSquared^(0.5) -- Converting to yards
local dmgTaken = 43740 + (183338*(40-distance)/40) -- Calculating the dmg taken by the explosion
local expTime = expirationTime or 0
expTime = (expTime-GetTime()) --Calculating the remaining duration in seconds
if (subIndex) then
printName = string.sub(destName, 1, subIndex-1) --Truncating "-" as well as Realm-Name
else
printName = destName
end
if(distance > 40.00) then --Unit is more than 40y away -> green text
return printName.."\n"..string.format("%.1f",expTime).."\n|cFF00FF00> "..format("%.1f",distance).." <|r"..format("\n%.f k", dmgTaken/1000)
else --Unit is less than 40y away - red text
return printName.."\n"..string.format("%.1f",expTime).."\n|cFFFF0000> "..format("%.1f",distance).." <|r"..format("\n%.f k", dmgTaken/1000)
end
gets me following error as soon as I close the WA menu
Code:
[string "return ..."]:2: unexpected symbol near 'local'
The aura doesn't work with this code.
Changing the code to
Code:
function(...)
local expirationTime, _, _, _, name = ...
local destName = name or "nil"
local subIndex = string.find(destName, "-")
local printName = "nil"
local distanceSquared = select(1,UnitDistanceSquared(destName)) -- Get distance of unit the aura triggered from
local distance = distanceSquared^(0.5) -- Converting to yards
local dmgTaken = 43740 + (183338*(40-distance)/40) -- Calculating the dmg taken by the explosion
local expTime = expirationTime or 0
expTime = (expTime-GetTime()) --Calculating the remaining duration in seconds
if (subIndex) then
printName = string.sub(destName, 1, subIndex-1) --Truncating "-" as well as Realm-Name
else
printName = destName
end
if(distance > 40.00) then --Unit is more than 40y away -> green text
return printName.."\n"..string.format("%.1f",expTime).."\n|cFF00FF00> "..format("%.1f",distance).." <|r"..format("\n%.f k", dmgTaken/1000)
else --Unit is less than 40y away - red text
return printName.."\n"..string.format("%.1f",expTime).."\n|cFFFF0000> "..format("%.1f",distance).." <|r"..format("\n%.f k", dmgTaken/1000)
end
end
results in
Code:
[string "return function() function()..."]:1: '<name>' expected near '('
[string "return function() function()..."]:1: '<name>' expected near '('
every time the aura is triggered, but remainder of the code works.