需要Logitech鼠标的帮助简单Lua代码

问题描述 投票:0回答:1

我正在尝试为Logitech鼠标创建脚本:

  1. 当按下鼠标左键时,将激活情况1
  2. [按住鼠标右键并按下鼠标左键,将激活情况2

但是,无论我如何尝试,它仅适用于情况1,请帮助我

EnablePrimaryMouseButtonEvents(true)
function OnEvent(event, arg)
    if (event == "MOUSE_BUTTON_PRESSED" and arg==1 and IsKeyLockOn("scrolllock")==false) then --Case 1: Press only  Button  1
        Sleep(77)   
        if(IsMouseButtonPressed(1))then
            MoveMouseRelative(0,4)
            Sleep(76)   
            end 
        if(IsMouseButtonPressed(1))then
            MoveMouseRelative(0,6)
            Sleep(62)   
            end 
        if(IsMouseButtonPressed(1))then
            MoveMouseRelative(0,5)
            Sleep(84)   
    end 
    elseif (event == "MOUSE_BUTTON_PRESSED" and arg==2 and IsKeyLockOn("scrolllock")==false) then --Case 2: Press button 1+2
            Sleep(77)   
        if(IsMouseButtonPressed(1))then
            MoveMouseRelative(0,8)
            Sleep(76)   
        end 
        if(IsMouseButtonPressed(1))then
            MoveMouseRelative(0,9)
            Sleep(62)   
        end 
        if(IsMouseButtonPressed(1))then
            MoveMouseRelative(0,0)
            Sleep(84)   
        end 
    end
end
lua logitech-gaming-software
1个回答
0
投票

您在elseif之前不能有end。 elseif会自动充当最后一个的end

© www.soinside.com 2019 - 2024. All rights reserved.