吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 1685|回复: 0
收起左侧

[求助] lua 脚本 如何实现按键循环

[复制链接]
雲朵乀 发表于 2020-5-6 17:26
本帖最后由 雲朵乀 于 2020-5-6 17:33 编辑

小弟不才,初学lua自己写了一个按键脚本代码如下
[XML] 纯文本查看 复制代码
function OnEvent(event, arg, family)
if (event == "MOUSE_BUTTON_PRESSED" and arg == 6) then
recoil = not recoil
end
-- 宏开关

if event == "MOUSE_BUTTON_PRESSED" and arg == 2 and recoil then   -- 第一组宏
PressAndReleaseKey("v")
Sleep(10)
PressAndReleaseKey("4")
Sleep(10)
PressAndReleaseKey("0")
Sleep(0)
PressAndReleaseKey("t")
Sleep(0)
PressAndReleaseKey("t")
Sleep(10)
PressAndReleaseKey("f")
Sleep(0)
PressAndReleaseKey("t")
Sleep(10)
PressAndReleaseKey("x")
Sleep(0)
PressAndReleaseKey("t")

end

function doWhileLoop()
    local i = 10;
    while i > 0 do
{if event == "MOUSE_BUTTON_PRESSED" and arg == 2 and recoil then
PressAndReleaseKey("v")
Sleep(10)
PressAndReleaseKey("4")
Sleep(10)
PressAndReleaseKey("0")
Sleep(0)
PressAndReleaseKey("t")
Sleep(0)
PressAndReleaseKey("t")
Sleep(10)
PressAndReleaseKey("f")
Sleep(0)
PressAndReleaseKey("t")
Sleep(10)
PressAndReleaseKey("x")
Sleep(0)
PressAndReleaseKey("t")}

        print(i)
        i = i - 1;
    end
end


if event == "MOUSE_BUTTON_PRESSED" and arg == 4 and recoil then   -- 第二组宏
PressAndReleaseKey("r")
Sleep(10)
PressAndReleaseKey("tab")

end
end

想让宏实现按下右键 一直循环按键,松开停止。但是总是不能实现。求各位大神指点迷津!

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-11-26 16:27

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表