如何使用 Lua 脚本切换宏开关

function OnEvent(event, arg, family)

if (event == "MOUSE_BUTTON_PRESSED" and arg == 5 and family == "mouse") then

PlayMacro("Lustre Rotation")

end

if (event == "MOUSE_BUTTON_RELEASED" and arg == 5 and family == "mouse") then

AbortMacro()

end

end

嗨,我一直在使用上面的 Lua 脚本(在 Logitech G Hub 上)以便在释放鼠标按钮时立即停止宏,但我不想按住鼠标按钮,而是想使用鼠标按钮切换宏。请指导我如何通过脚本来改变鼠标按钮以切换宏开关。谢谢!

点赞
用户12036949
用户12036949
## 函数 `OnEvent(event, arg)`
这个函数接收两个参数 `event` 和 `arg`.

如果 `event` 等于 `"G_PRESSED"` 并且 `arg` 等于 1,那么执行以下逻辑:
- `AutoToggle` 取反
- 如果此时 `AutoToggle` 为真,执行宏命令 `"Lustre Rotation"`
- 否则,中止宏命令的执行
2021-07-23 23:26:53