我的罗技 G500 有一个小宏 - 我在 FPS 游戏中使用它来减少后坐力。请看下面的脚本:
EnablePrimaryMouseButtonEvents(true)
function OnEvent(event, arg)
if event == "MOUSE_BUTTON_PRESSED" and arg == 1 then
repeat
MoveMouseRelative(-1,2)
Sleep(16)
until not IsMouseButtonPressed(1)
end
end
问题是这个脚本一直在工作。我希望按下另一个按钮 1 以开始在按钮 2 上使用脚本并重新按下按钮 1 以中断脚本
我试图设置标志,例如:
unction OnEvent(event, arg)
if event == "MOUSE_BUTTON_PRESSED" and arg == 6 then --set flag for mb1
mb1_pressed = true
elseif event == "MOUSE_BUTTON_RELEASED" and arg == 6 then --set flag for mb1=false
mb1_pressed = false
end
If mb1_pressed then
if event == "MOUSE_BUTTON_PRESSED" and arg == 1 and then
repeat
MoveMouseRelative(-1,2)
Sleep(16)
until not IsMouseButtonPressed(1)
end
end
但它不起作用。请你帮助我好吗 ?