No recoil script, problem with speed control

Ask gaming related questions (AHK v1.1 and older)
zeth9975101
Posts: 1
Joined: 23 Apr 2024, 14:22
Contact:

No recoil script, problem with speed control

Post by zeth9975101 » 23 Apr 2024, 14:30

Code: Select all

#Persistent

; Configuración inicial
RecoilControlStrength := 1000  ;
Toggle := false  ; Estado inicial del script

;
MoveMouseDown() {
    while (Toggle) {
        ;
        MouseSpeed := Round(RecoilControlStrength * 2)  ;
        
        ; Mueve el mouse hacia abajo con la velocidad calculada
        DllCall("mouse_event", uint, 1, int, 0, int, MouseSpeed, uint, 0, uint, 0)
        
        Sleep, 5  ;
    }
}

;
k:: 
    Toggle := !Toggle  ;
    
    if (Toggle)
        MoveMouseDown()  ;
return

Hello, I made this simple script so that when you press right and left click at the same time the mouse goes down, the problem is that I cannot get the speed to regulate, it is assumed that when modifying this variable RecoilControlStrength := 1000
The cursor would have to move faster or slower but that doesn't happen.

Code: Select all

EnableRCS = true --- When Set to false, it'll turn off Recoil Control!


RcCustomStrength = 7 -- Value MUST be ROUNDED! No Decimal values such as 6.5!

RequireToggle = true -- Change to false if you want it to always be on.

ToggleKey = "CapsLock" -- Usable Keys: "CapsLock", "NumLock", "ScrollLock"

DelayRate = 7 -- DO NOT CHANGE IF YOU DON'T KNOW WHAT YOU'RE DOING.

RecoilControlMode = "A4" ---

if RecoilControlMode == "Low" then
  RecoilControlStrength = 2
  
end

EnablePrimaryMouseButtonEvents  (true);
function OnEvent(event,arg)
if EnableRCS ~= false then
if RequireToggle ~= false then
    if IsKeyLockOn(ToggleKey)then
        if IsMouseButtonPressed(3)then
            repeat
                if IsMouseButtonPressed(1) then
                    repeat
                        MoveMouseRelative(0,RecoilControlStrength)
                        Sleep(DelayRate)
                    until not IsMouseButtonPressed(1)
                end
            until not IsMouseButtonPressed(3)
        end
    end
    
else 

        if IsMouseButtonPressed(3)then
            repeat
                if IsMouseButtonPressed(1) then
                    repeat
                        MoveMouseRelative(0,RecoilControlStrength)
                        Sleep(DelayRate)
                    until not IsMouseButtonPressed(1)
                end
            until not IsMouseButtonPressed(3)
        end
    end
else 
end  
end
I based it on this script for the logitech g hub that uses lua scripts

[Mod edit: Added [code][/code] tags. Please use them yourself when posting code!]
[Mod edit: Moved topic from AHK v2 help since this is v1 code.]

Return to “Gaming Help (v1)”