如何在Lua中向密钥垃圾邮件

问题描述

我想在Logitech鼠标上使用它。

我知道这是一个错误代码,因为我不知道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

解决方法

按下鼠标按钮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