如何在 Lua 中快速输入按键

我想在我的罗技鼠标上使用它。

我知道这是糟糕的代码,因为我不懂 Lua。

function OnEvent(event, arg)
    if input.IsKeyDown(KEY_L) then
        PressKey("l")
        Sleep(0)
        ReleaseKey("l")
        PressKey("enter")
        Sleep(0)
        ReleaseKey("enter")
    end
end
点赞
用户1847592
用户1847592

当鼠标 4 按钮被按下时的垃圾信息发送

function OnEvent(event, arg)
  if event == "MOUSE_BUTTON_PRESSED" and arg == 4 then
     repeat
        PressKey("l")
        Sleep(10)
        ReleaseKey("l")
        PressKey("enter")
        Sleep(10)
        ReleaseKey("enter")
     until not IsMouseButtonPressed(4)
  end
end
2020-08-31 11:11:27