我正在用 LUA/logitech 脚本 API 编写脚本。该脚本应执行以下操作:
代码如下:
forceMove = false
on = false
function OnEvent(event, arg)
--OutputLogMessage("event = %s, arg = %s\n", event, arg);
if IsMouseButtonPressed(5) then
forceMove = not forceMove
while(on) do
if(forceMove) then
ForceMove()
else
StartAttack()
end
end
ReleaseMouseButton(5)
end
if IsMouseButtonPressed(4) then
on = not on
ReleaseMouseButton(4)
end
end
function StartAttack()
PressAndReleaseMouseButton(1)
Sleep(1000)
end
function ForceMove()
MoveMouseWheel(1)
Sleep(20)
MoveMouseWheel(-1)
end
但是一旦在游戏中,如果我用鼠标按钮 4 激活脚本,我就会陷入“强制移动”模式,而“自动攻击”模式永远不会起作用。想不通为什么。