2XuActive
2XuActive

Reputation: 9

need help changing logitech script

i have this script that want to change capslock button to on/off without holding lctrl to activate. Who can help me? Thank you everyone


function OnEvent(event, arg)
    if IsModifierPressed("lctrl") then
        repeat  
            if IsMouseButtonPressed(1) then
                repeat
                    PressMouseButton(1)
                    Sleep(15)
                    ReleaseMouseButton(1)
                until not IsMouseButtonPressed(1)
            end             
        until not IsModifierPressed("lctrl")
    end         
end

Upvotes: -2

Views: 105

Answers (1)

ESkri
ESkri

Reputation: 1928

  1. In the game, in the "Controls Settings", introduce alternative key for "Shoot" action.
    (I assume your game allows binding two different keys for the same 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. Try to play the game with both LMB and P for shooting.
    Make sure you can shoot with P key while keeping LMB pressed.
    (Some games do not allow this)

  3. The script

EnablePrimaryMouseButtonEvents(true)

function OnEvent(event, arg)
   if event == "MOUSE_BUTTON_PRESSED" and arg == 1 and IsKeyLockOn("capslock") then
      repeat
         PressAndReleaseKey("P")
         Sleep(15)
      until not IsMouseButtonPressed(1) 
   end
end            

Upvotes: 1

Related Questions