Doing a lot of rated 2s and 3s with no voice as a mage. Trying to make a macro that lets whatever rogue I’m playing with know that Dragon’s Breath is available to cast. It works, but if I spam press the keybind it will spam the chat message. How can I make it not spam?
#showtooltip
/use Dragon's Breath
/run C_Timer.After(18, function() SendChatMessage("DB Available!", "PARTY");end)
Assuming Weak Auras is available for Classic, you’d probably be better off doing it there.
If not, you need a global to tell you if you have a timer pending and to suppress any new ones if you do.
Something like this (not tested)…
if not MyGlobalCheck then MyGlobalCheck = true C_Timer.After(18, function() SendChatMessage("DB Available!", "PARTY") MyGlobalCheck = false end) end
Look up. I posted it as an edit.
Thank you. Just tested it and the LUA Error came back as:
Message: [string "if not MyGlobalCheck then MyGlobalCheck = true C_Timer.After(18..."]:1: 'end' expected near '<eof>'
Time: Mon Oct 24 12:42:57 2022
Count: 1
Stack: [string "if not MyGlobalCheck then MyGlobalCheck = true C_Timer.After(18..."]:1: 'end' expected near '<eof>'
[string "=[C]"]: ?
[string "=[C]"]: in function `RunScript'
[string "@Interface\FrameXML\ChatFrame.lua"]:2155: in function `?'
[string "@Interface\FrameXML\ChatFrame.lua"]:5188: in function `ChatEdit_ParseText'
[string "@Interface\FrameXML\ChatFrame.lua"]:4852: in function `ChatEdit_SendText'
[string "@Interface\FrameXML\ChatFrame.lua"]:3100: in function <Interface\FrameXML\ChatFrame.lua:3093>
[string "=[C]"]: in function `UseAction'
[string "@Interface\FrameXML\SecureTemplates.lua"]:364: in function `handler'
[string "@Interface\FrameXML\SecureTemplates.lua"]:677: in function <Interface\FrameXML\SecureTemplates.lua:621>
[string "=[C]"]: ?
[string "@Interface\FrameXML\SecureHandlers.lua"]:266: in function <Interface\FrameXML\SecureHandlers.lua:263>
[string "=[C]"]: ?
[string "@Interface\FrameXML\SecureHandlers.lua"]:296: in function <Interface\FrameXML\SecureHandlers.lua:279>
[string "=(tail call)"]: ?
Locals:
I added an end to the end.
Works perfect now. Huge help! Thank you.

No problem. That’s why we’re here.
FYI, for future readers - if you have more than one check to make you can do it this way:
/run if not MyGlobalCheck then MyGlobalCheck={}end local mgc=MyGlobalCheck if not mgc.A then mgc.A = true C_Timer.After(18, function() SendChatMessage("DB Available!", "PARTY") mgc.A = false end) end
If you need more, use .B and .C et cetera as needed.
It’s not the best thing in the world to do putting Globals in macros, but on occasion and in a limited way and making absolutely sure that global isn’t being used somewhere else, it can solve a limited problem.