- -----这是Automacro的核心部分,不需要修改!------
- local default = CreateFrame("Frame", "AutoM", UIParent)
- default:Hide()
- default:SetScript("OnKeyUp", function(self, key) print(key) end)
- function AM_AM(msg)
- if msg then
- macrobody = GetMacroBody(GetRunningMacro())
- StopMacro()
- --print(script) -- Debug
- --print(ConvertMacroToScript(macrobody))
- RunScript(ConvertMacroToScript(macrobody))
- end
- end
- function ConvertMacroToScript(macrobody)
- if macrobody==nil then return end;
- macrobody = gsub(macrobody,"/am","")
- macrolist = strsplit("\n",macrobody)
- local count = select(2,gsub(macrobody,"\n","\n"))
- local macrolist ={}
- for i=1,count+1 do
- macrolist[i] = select(i,strsplit("\n",macrobody))
- end
- local script = ""
- for i=1,count+1 do
-
- if strsub(macrolist[i],1,5)=="/run " then
- local sub_script= gsub(macrolist[i],"/run ","")
- script = script .. sub_script .."\n"
- else
- if strsub(macrolist[i],1,4)=="/if " then
- local condition= gsub(macrolist[i],"/if ","")
- script = script .. "if " .. condition.." then\n"
- else
- if strsub(macrolist[i],1,6)=="/else" then
- script = script .. "else\n"
- else
- if strsub(macrolist[i],1,5)=="/end" then
- script = script .. "end\n"
- else
- if macrolist[i]~="\n" and macrolist[i]~=" " then
- script = script .. "RunMacroText\(""..macrolist[i]..""\)\n"
- end
- end
- end
- end
- end
-
- end
- return script
- end
- SlashCmdList["AM"]=AM_AM;
- SLASH_AM1="/am";
复制代码 我用的这个AM_Core.lua,就正常了。/click ActionButton 也可以使用!
|