Hi. I create addon for tracking eclipse on my moonkin this addon display 4 states :
1: on Solar eclipse: "Eclipse Wrath"
2: on Lunar eclipse: "Eclipse Starfire"
3: after Lunar eclipse: "Starfire"
4: after Solar eclipse: "Wrath"
I don't no how to make reset all states to state "1" after 30 second. mayby anyone can help me ?
eclips.lua
Code:
y=1
function Eclips_OnEvent(event)
if (event == "UNIT_AURA") then
name, rank = UnitAura("player", "Eclipse (Solar)");
name2, rank = UnitAura("player", "Eclipse (Lunar)");
if (name=="Eclipse (Solar)") then
EclipsFrame:AddMessage("Eclipse\nWrath!", 0, 1, 0, 1, 4);
y=1
elseif((y==1) and not(name == "Eclipse (Solar)") and not(name2=="Eclipse (Lunar)")) then
EclipsFrame:AddMessage("\nWrath!", 0, 1, 0, 1, 4);
elseif (name2=="Eclipse (Lunar)") then
EclipsFrame:AddMessage("Eclipse\nStarfire!", 0, 0, 1, 1, 4);
y=2
elseif((y==2) and not(name == "Eclipse (Solar)") and not(name2=="Eclipse (Lunar)")) then
EclipsFrame:AddMessage("\nStarfire!", 0, 0, 1, 1, 4);
return;
end
end
end
Eclips.xml
Code:
<Ui xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.blizzard.com/wow/ui/">
<Script file="Eclips.lua" />
<MessageFrame name="EclipsFrame" displayDuration="" insertMode="TOP" parent="UIParent" frameStrata="LOW" toplevel="true">
<Size>
<AbsDimension x="200" y="40"/>
</Size>
<Anchors>
<Anchor point="CENTER">
<Offset>
<AbsDimension x="145" y="-25"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
this:RegisterEvent("UNIT_AURA");
</OnLoad>
<OnEvent>
Eclips_OnEvent(event);
</OnEvent>
</Scripts>
<FontString inherits="SystemFont_OutlineThick_Huge4" justifyH="CENTER"/>
</MessageFrame>
</Ui>
P.S sorry for my bad english.