G HUB 脚本在我松开鼠标按钮 8 后仍然无限循环运行

程序似乎无法检测到我何时松开鼠标按钮 8 并且会无限循环运行。

EnablePrimaryMouseButtonEvents(true)

function OnEvent(event, arg)
   if event == "MOUSE_BUTTON_PRESSED" and arg == 8 then
      repeat
         PressMouseButton(1)
         Sleep(math.random(15, 45))
         ReleaseMouseButton(1)
         Sleep(math.random(15, 45))
      until event == "MOUSE_BUTTON_RELEASED" and arg == 8
   end
end
点赞
用户7509065
用户7509065
`event` 是一个函数内部不会改变的本地变量,所以你的循环会一直运行直到它发生变化。你需要让函数返回并再次被用新的参数调用。
2020-06-11 05:47:45