Search code examples
luamacroslogitechlogitech-gaming-software

- Logitech macros ! the command doesn't stop while I'm holding down the right mouse button


https://docs.google.com/document/d/1pX81q-AEn2o7n0rlpvD-GOoKCakMxqO0v8-JXPjtEnA/edit?usp=sharing

----- - here are all my LUA files

  • here are all my Lua files! they are used in LOGitech Ghud . when the macro is active, hold down the right mouse button and press the left mouse button to start the macro ( you cannot stop the macro while you are holding the right mouse button!) - I want them to stop when I release the left mouse button
    RC_COUNT = #RC_TABLE
    local LastIndex = 1
    if IsMouseButtonPressed(1)then 
        if (LastIndex <= RC_COUNT) then
            i = LastIndex
        else
            i = 1
        end
        while i <= RC_COUNT do
            if IsMouseButtonPressed(3)then
                PressAndReleaseMouseButton(1)
                MoveMouseRelative(RC_TABLE[i].x, RC_TABLE[i].y)Sleep(18)

            else
                LastIndex = i
                break
            end
            i = i + 1
        end
    end
end

when i right click my command will use ! and I left click they will continue working


Solution

    1. In the game, in the "Controls Settings", introduce alternative key for "Shoot" action. For example, let it be keyboard key P. So, now in the game you can shoot either using Left Mouse Button or using Keyboard key P. Of course, you will use LMB for manual shooting as usually, but your GHub script will use P.

    2. Replace these two lines

            if IsMouseButtonPressed(3)then
                PressAndReleaseMouseButton(1)
    

    with the following:

            if IsMouseButtonPressed(3) and IsMouseButtonPressed(1) then
                PressAndReleaseKey("P")