I was hoping someone would be able to help me. This is what I'm trying to do.
Show a countdown of each of the hot spells that I cast on a unit. The countdown should be in a specific color to indicate which spell it is.
I know very little about LUA and have attempted to get something working by looking at examples in this forum and other forums. Below are my attempts. They either show an error or the duration doesn't display correctly and doesn't count down. I've only coded my examples for rejuvenation until I know that spell is working. I add the text to LUA text for pitbull; I don't change any other settings except for I set the event to UNIT_AURA. Is there anything other event I should use? Anything else I need to do to make sure it works correctly? What is the best way to code what I want to do? Where am I going wrong in my examples?
Thank you so much for your time and help!
Attempt #1 (would have to update all the spells to be like rejuvenation)
local text = ""
Outline()
local name,_,icon,_,_,_,expires,caster = UnitAura(unit,"Rejuvination")
if name == "Rejuvination" and caster == "player" then
UpdateIn(.1)
local rem = GetTime() - expires
text = text .. format("|cffff0000%s|r[%d]", rem)
end
if UnitAura(unit, "Regrowth") ~= nil then
text = text .. format("|cff00ff00%s|r","R")
end
if UnitAura(unit, "Wild Growth") ~= nil then
text = text .. format("|cffffff00%s|r","WG")
end
if UnitAura(unit, "Lifebloom") ~= nil then
_,_,_,count = UnitAura(unit, "Lifebloom")
text = text .. format("|cffffff00%s|r[%d]","LB",count)
end
return text
Attempt #2 (would have to create an elseif for each spell)
local text = ""
local i = 1
while true do
local name,_,icon,_,_,_,expires,caster = UnitAura(unit,i,"HELPFUL")
if not name then
break
elseif name == "Rejuvination" and caster == "player" then
UpdateIn(.1)
local rem = GetTime() - expires
text = text .. format("|cffff0000%s|r[%d]", rem)
break
end
i=i+1
end