罗技G hub lua脚本

发布于 2025-01-10 02:42:49 字数 362 浏览 4 评论 0原文

EnablePrimaryMouseButtonEvents(true)

function OnEvent(event, arg)
    --OutputLogMessage("Event: "..event.." Arg: "..arg.."\n")
  if (event == "MOUSE_BUTTON_PRESSED" and arg == 11) then
    repeat
      PressAndReleaseMouseButton(1)
      Sleep(1,2)
    until not MOUSE_BUTTON_PRESSED("11")
  end  
end

我这样做了,但第一行出现错误,但我不确定问题是什么。

EnablePrimaryMouseButtonEvents(true)

function OnEvent(event, arg)
    --OutputLogMessage("Event: "..event.." Arg: "..arg.."\n")
  if (event == "MOUSE_BUTTON_PRESSED" and arg == 11) then
    repeat
      PressAndReleaseMouseButton(1)
      Sleep(1,2)
    until not MOUSE_BUTTON_PRESSED("11")
  end  
end

I did this, but an error appears on the first line, but I'm not sure what the problem is.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦过后 2025-01-17 02:42:49

有两个错误:

  • Sleep(1,2) 不正确:
    Sleep 需要一个参数 - 整数毫秒。
    例如,使用 Sleep(10)
  • MOUSE_BUTTON_PRESSED("11") 是未知函数

如果要确定按钮 #11 是否按下:

  1. 将命令“返回”分配给G Hub 用户界面中的鼠标按钮#11;
  2. 在脚本中使用 IsMouseButtonPressed(4)
function OnEvent(event, arg)
    --OutputLogMessage("Event: "..event.." Arg: "..arg.."\n")
  if event == "MOUSE_BUTTON_PRESSED" and arg == 11 then
    repeat
      PressAndReleaseMouseButton(1)
      Sleep(10)
    until not IsMouseButtonPressed(4)
  end  
end

There are two mistakes:

  • Sleep(1,2) is incorrect:
    Sleep expects a single argument - an integer amount of milliseconds.
    For example, use Sleep(10)
  • MOUSE_BUTTON_PRESSED("11") is unknown function

If you want to determine whether button #11 is down:

  1. Assign a command "Back" to the mouse button #11 in the user interface of G Hub;
  2. Use IsMouseButtonPressed(4) in the script:
function OnEvent(event, arg)
    --OutputLogMessage("Event: "..event.." Arg: "..arg.."\n")
  if event == "MOUSE_BUTTON_PRESSED" and arg == 11 then
    repeat
      PressAndReleaseMouseButton(1)
      Sleep(10)
    until not IsMouseButtonPressed(4)
  end  
end
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文