Code:
local a=CreateFrame("Frame")
local delay = 300 -- in seconds, so 300 would be 5 min
a:Hide()
local function sendmsg()
if a.disabled then return end
if not a.msg then return end
SendChatMessage(a, "GUILD")
end
a:SetScript("OnUpdate", function(self, elapsed)
self.elapsed = (self.elapsed or 0)+elapsed
if self.elapsed >= delay then
self.elapsed = self.elapsed-delay
sendmsg()
end
end)
SlashCmdList["GUILDANNOUNCE"] = function(input)
if a.disabled then
a.disabled = false
print("GuildAnnounce: No longer announcing")
sendmsg()
elseif strlen(input)>0 then
a.disabled = false
print("GuildAnnounce: Announcing \""..input.."\" every "..input.." seconds")
a.msg = input
sendmsg()
elseif a.msg then
a.disabled = false
print("GuildAnnounce: Announcing \""..a.msg.."\" every "..input.." seconds")
sendmsg()
end
end
SLASH_GUILDANNOUNCE1="/guildannounce"
SLASH_GUILDANNOUNCE2="/gannounce"
How to use. Untested. Report back with issues.
Code:
/guildannounce [msg]
to enable. If no msg is specified, previous message is used.
to toggle back off.