欢迎光临散文网 会员登陆 & 注册

罗技lua随机延迟实现

2023-07-29 10:03 作者:_RPG_  | 我要投稿

主要实现是 match.random(a,b)

function OnEvent(event, arg)

    --OutputLogMessage("Event: "..event.." Arg: "..arg.."\n")

    if (event == "MOUSE_BUTTON_PRESSED" and arg == 5) then

        bool = not bool

        OutputLogMessage("bool= %s \n  ", bool)

    end


    if (event == "MOUSE_BUTTON_PRESSED" and IsKeyLockOn("capslock")) then

        OutputLogMessage("OPENKEY= %s \n  ", IsKeyLockOn("capslock"))

        if(  bool ) then

          repeat

              --random1

              random1 = math.random(0, 100)

              --random2

              random2 = math.random(0, 100)

              --核心执行

              Sleep(random1)

              PressAndReleaseKey("1")

              Sleep(random2)

              OutputLogMessage("random1=%s\n random2=%s\n ", random1, random2)

          until not IsKeyLockOn("capslock")

          bool =false

          OutputLogMessage("bool = %s \n  ", bool)

        end

    end

    if (event == "MOUSE_BUTTON_PRESSED" and not IsKeyLockOn("capslock") and bool ==false ) then

        OutputLogMessage("CLOSE= %s \n  ", IsKeyLockOn("capslock"))

    end

end


罗技lua随机延迟实现的评论 (共 条)

分享到微博请遵守国家法律