From 9f5a379a3b0ada9f4e16250c57830161196fab6f Mon Sep 17 00:00:00 2001 From: Jrc13245 Date: Sat, 13 Dec 2025 19:38:54 -0500 Subject: [PATCH] fix stopmacro affecting non cast lines --- Compatibility/SuperMacro.lua | 14 +++----------- Core.lua | 35 ++++++++++++++++++----------------- 2 files changed, 21 insertions(+), 28 deletions(-) diff --git a/Compatibility/SuperMacro.lua b/Compatibility/SuperMacro.lua index 3045c58..9b33b47 100644 --- a/Compatibility/SuperMacro.lua +++ b/Compatibility/SuperMacro.lua @@ -65,17 +65,9 @@ do -- SuperMacro calls RunLine(line) one line at a time; handle first arg. local text = arg and arg[1] - -- Clear stopmacro if this is a new button press (different frame) - local now = GetTime() - if CRM.stopmacro and CRM.stopmacroTime and (now - CRM.stopmacroTime) > 0 then - CRM.stopmacro = false - end - - -- respect /stopmacro guard - if CRM.stopmacro then - CRM.stopmacro = false - return true - end + -- NOTE: stopmacro is now checked in DoCast directly, not here. + -- This allows non-cast commands (like /qh) to execute even after a successful /cast. + -- The stopmacro flag only blocks subsequent /cast lines via DoCast's internal check. if type(text) == "string" then -- 1) special-case /castsequence → call CRM directly and RETURN TRUE diff --git a/Core.lua b/Core.lua index 3eb7321..31913d7 100644 --- a/Core.lua +++ b/Core.lua @@ -1231,13 +1231,9 @@ function CleveRoids.ExecuteMacroBody(body,inline) end for k,v in pairs(lines) do - if CleveRoids.stopmacro then - CleveRoids.stopmacro = false - if CleveRoids.macroRefDebug then - CleveRoids.Print("|cffff8800[MacroRef]|r Stopped by stopmacro flag at line " .. k) - end - return true - end + -- NOTE: stopmacro is now only checked in DoCast, not here. + -- This allows non-cast commands (like /qh) and macro references to execute + -- even after a successful /cast. The stopmacro flag only blocks subsequent /cast lines. if CleveRoids.macroRefDebug then CleveRoids.Print("|cff88ff88[MacroRef]|r Executing line " .. k .. ": " .. string.sub(v, 1, 60)) end @@ -2178,6 +2174,18 @@ function CleveRoids.DoCast(msg) CleveRoids.stopmacro = false end + -- Check stopmacro to prevent spell queue replacement, but allow macro references through + -- Macro references {MacroName} should always execute so they can handle their own logic + local trimmedMsg = CleveRoids.Trim(msg or "") + local isMacroRef = string.sub(trimmedMsg, 1, 1) == "{" and string.sub(trimmedMsg, -1) == "}" + if CleveRoids.stopmacro and not isMacroRef then + if CleveRoids.macroRefDebug then + CleveRoids.Print("|cffff8800[DoCast]|r Blocked by stopmacro: " .. (msg or "")) + end + CleveRoids.stopmacro = false + return false + end + local handled = false for k, v in pairs(CleveRoids.splitStringIgnoringQuotes(msg)) do @@ -3631,16 +3639,9 @@ local function CRM_SM_InstallHook() RunLine = function(...) local text = (arg and arg[1]) or nil - -- Clear stopmacro if this is a new button press (different frame) - local now = GetTime() - if CleveRoids.stopmacro and CleveRoids.stopmacroTime and (now - CleveRoids.stopmacroTime) > 0 then - CleveRoids.stopmacro = false - end - - if CleveRoids.stopmacro then - CleveRoids.stopmacro = false - return true - end + -- NOTE: stopmacro is now checked in DoCast directly, not here. + -- This allows non-cast commands (like /qh) to execute even after a successful /cast. + -- The stopmacro flag only blocks subsequent /cast lines via DoCast's internal check. if type(text) == "string" then -- 1) SPECIAL-CASE: /castsequence (no token required)