注册 登录
编程论坛 Lua论坛

LUA插件问题求指导

liuguyu678 发布于 2020-11-14 23:11, 2144 次点击
WOW游戏中聊天窗口提示需要回答计算题答案,如图
[local]1[/local]
自写LUA插件代码如下,运行无结果,求会WOW的LUA大佬指导,有偿。

local E = "CHAT_MSG_SYSTEM"
function A() if (event == E) then G_WE(arg1) end end
local F = CreateFrame("Frame")
F:SetScript("OnEvent", A)
F:RegisterEvent(E)

local T, F = T or 0, F or CreateFrame("frame")
X =
    X == nil and function() if StaticPopup1:IsShown() then G_WE2(arg2) end end or
        nil;
F:SetScript("OnUpdate", X)


function G_WE2(arg2)

    arg2 = StaticPopup1Text:GetText()   
                                         
    if string.match(arg2, "以下问题的答案:") then

        arg2 = strreplace(arg2, " ", "")   

        local arg2 = Str_Cut(arg2, "以下问题的答案:", "=")

        local arg2 = string.sub(arg2, 81, -36)

        local msg11 = string.match(arg2, "%d+")

        local msg22 = string.match(arg2, "%d+(%p)")

        local msg33 = string.match(arg2, "%d+%p(%d+)")

        if msg22 == "-" then

            jian = msg11 - msg33;

            StaticPopup1Button1:Click()

            StaticPopup1EditBox:SetText(tostring(jian))

            StaticPopup1Button1:Click()

        elseif msg22 == "+" then

            jia = msg11 + msg33;

            SendChatMessage(tostring(jia),"say");        

            print(" ")

            print(" ")                    

            print(" ")

            StaticPopup1Button1:Click()

            StaticPopup1EditBox:SetText(tostring(jia))

            StaticPopup1Button1:Click()

        end

    end

end



0 回复
1