标题:LUA插件问题求指导
只看楼主
liuguyu678
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2020-11-14
 问题点数:0 回复次数:0 
LUA插件问题求指导
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



搜索更多相关主题的帖子: string then LUA local 
2020-11-14 23:11



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-503896-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.086670 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved