local disabled = false -- Starting value SLASH_AutoBuffer1 = "/AutoBuffer" SLASH_AutoBuffer2 = "/AB" -- Add as many variations as you like just increment the number SlashCmdList["AutoBuffer"] = function(editBox, msg) if msg then msg = string.lower(msg) if msg == "on" then -- on disabled = false elseif msg == "off" then -- off disabled = true else disabled = not disabled -- Toggles addon if 'on' or 'off' is not used. end if disabled then SendSystemChat("AutoBuffer is disabled") SendChatMessage("|H|h|cffFF0000AutoBuffer has been deactivated|h", "party") else SendSystemChat("AutoBuffer is enabled") SendChatMessage("|H|h|cff16DC07AutoBuffer has been activated|h", "party") end end end local AutoBuffer = {} -- the AddOn namespace, all your functions should be placed inside here instead of as globals. _G.AutoBuffer = AutoBuffer -- expose it to the global scope function AutoBuffer.OnEvent(event, arg1, arg2, arg3, arg4) if event == "CHAT_MSG_PARTY" then if arg1 == "warlock" then TargetUnit("player", "event") CastSpellByName("Sublimation Weave Curse") "AutoBuffer.VN()" end end end local time_remaining = 1 -- in seconds function AutoBuffer:OnUpdate(elapsed) if disabled == true then return end -- elapsed is the amount of time in seconds since the last frame tick time_remaining = time_remaining - elapsed if time_remaining > 0 then -- cut out early, we're not ready yet return end time_remaining = 1 -- reset to 2 seconds AutoBuffer.VN() end