嘿,伙计们,我最近开始尝试为Logitech GHUB写一些简单的Lua脚本。我终于让它们以我喜欢的方式工作了,但我对这个有点麻烦。当我释放Mouse5时,它不会立即停止,它将继续执行脚本直到结束。但是,如果我释放鼠标5,我希望它立即停止。我该怎么做?
function OnEvent(event, arg)
if event == "MOUSE_BUTTON_PRESSED" and arg == 5 then
repeat
Sleep(40)
PressMouseButton(1)
Sleep(1150)
ReleaseMouseButton(1)
until not IsMouseButtonPressed(5)
end
end
感谢您的帮助:-)
发布于 2019-11-16 17:16:02
function OnEvent(event, arg)
if event == "MOUSE_BUTTON_PRESSED" and arg == 5 then
repeat
Sleep(40)
PressMouseButton(1)
local tm = GetRunningTime()
local exiting
repeat
Sleep(50)
exiting = not IsMouseButtonPressed(5)
until exiting or GetRunningTime() - tm > 1150
ReleaseMouseButton(1)
until exiting
end
end
https://stackoverflow.com/questions/58885834
复制相似问题