lualogitechlogitech-gaming-software

Lua script to execute commands after pressing a few keys


Today I bought a logitek g502x mouse started writing scripts (I had never written them before) I looked in different places and saw an interesting option

The script that i make, does not return errors, but for some reason it does not do anything. What have I done wrong?

EnablePrimaryMouseButtonEvents(true);
function OnEvent(event, arg)
    if IsMouseButtonPressed(1) then
        repeat
        if IsModifierPressed ("shift") then
            repeat
                    if IsModifierPressed ("w") then
                    ---
                        PressAndReleaseKey("LCTRL") 
                        Sleep(10) 

                        MoveMouseTo(33000, 55000)
                        Sleep(50) 

                        PressMouseButton(1) 
                        Sleep(130) 

                        ReleaseMouseButton(1) 
                        Sleep(10) 

                        PressAndReleaseKey("LCTRL") 
                        Sleep(10)
                    ---
                    end
                   until not IsModifierPressed ("shift")
               end       
        until not IsMouseButtonPressed(1)
     end
end

Solution

  • It is working as intended, the reason it does not have the desired outcome is because "w" is not a valid parameter for the method IsModifierPressed() which (as the name implies) checks modifier keys not normal keys, thus it returns false for "w". The api reference is here and lists all valid modifiers for your convenience on page 17.