Lua api 脚本更改保持键切换

时间:2021-06-25 18:20:40

标签: api lua script logitech logitech-gaming-software

嘿,我想修改这个脚本,现在我需要按住鼠标右键让脚本运行。我想将其更改为切换右键单击,然后在按住左键单击时让它运行,直到我再次按右键单击。有人知道怎么做吗?

EnablePrimaryMouseButtonEvents(true);
 
function OnEvent(event, arg)
    if IsKeyLockOn("numlock" )then
        if IsMouseButtonPressed(3)then
            repeat  
                if IsMouseButtonPressed(1) then
                    repeat
                        MoveMouseRelative(1,7)
                        Sleep(30)
                    until not IsMouseButtonPressed(1)
                end             
            until not IsMouseButtonPressed(3)
        end     
    end
end

1 个答案:

答案 0 :(得分:0)

试试这个:

local recoil_mode

function OnEvent(event, arg)
   if event == "PROFILE_ACTIVATED" then
      EnablePrimaryMouseButtonEvents(true)
   elseif event == "MOUSE_BUTTON_PRESSED" and arg == 2 then
      recoil_mode = not recoil_mode
   elseif event == "MOUSE_BUTTON_PRESSED" and arg == 1 and recoil_mode and IsKeyLockOn("numlock") then
      repeat
         MoveMouseRelative(1,7)
         Sleep(30)
      until not IsMouseButtonPressed(1)
   end
end