本帖最后由 雲朵乀 于 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
想让宏实现按下右键 一直循环按键,松开停止。但是总是不能实现。求各位大神指点迷津! |