Hi Rixxon,
This should work:
Lua Code:
local messages = {
{ time = 0, channels = "SAY", message = "Manaflut ! Kuscheln !!" },
{ time = 60, channels = "PARTY", message = "MANATIDE 2MIN CD" },
{ time = 120, channels = "PARTY", message = "MANATIDE 1MIN CD" },
{ time = 150, channels = "PARTY RAID", message = "MANATIDE 30SEK CD" },
}
local counter, nextMessage = 0, 1
local addon = CreateFrame( "Frame" )
addon:RegisterEvent( "UNIT_SPELLCAST_SUCCEEDED" )
addon:SetScript( "OnEvent", function( self, event, unit, _, _, _, spell )
if unit == "player" and spell == 16190 then
-- You cast Mana Tide!
-- Start running the messages.
counter, nextMessage = 0, 1
self:Show()
end
end )
addon:Hide()
addon:SetScript( "OnUpdate", function( self, elapsed )
-- Add up how much time has passed
-- since you cast Mana Tide.
counter = counter + elapsed
local m = messages[ nextMessage ]
if counter < m.time then
-- It's not time for a message yet.
return
end
-- Send the message!
for channel in m.channels:gmatch("%S+") do
SendChatMessage( m.message, channel )
end
-- Queue up the next message.
nextMessage = nextMessage + 1
-- Find out if it's done.
if not messages[ nextMessage ] then
self:Hide()
counter, nextMessage = 0, 1
end
end )
Please post any errors!