A single finction doesnt seem to be working with another one.

Ask gaming related questions (AHK v1.1 and older)
User avatar
VenomousReaperGoat
Posts: 3
Joined: 17 Jan 2024, 01:51
Contact:

A single finction doesnt seem to be working with another one.

09 Feb 2024, 04:03

So basically, i have this script, and for some reaspon, when i toggle the auto rightclick thing, it wont work with the recoil... i want it to auto right click and use the norecoil function at the same time.

Code: Select all

#NoEnv
#SingleInstance force
#maxthreadsperhotkey 5
#InstallKeybdHook
#InstallMouseHook

SendMode Input
SetKeyDelay, 0
SetMouseDelay, 0

rpm := 800
NoRecoil := 0
enough := 0
period := 6000
;xhair := 0

PixelUp := "Down"
PixelDown := "Up"
PixelLeft := "Right"
PixelRight := "Left"
ToggleNoRecoil := "Numpad0"
DelayUp := "NumpadDiv"
DelayDown := "NumpadMult"
PeriodUp := ""
PeriodDown := ""
LargeRecoilPreset := ""
SmallRecoilPreset := ""
MoveY := "LButton"
ToggleHoldRightClick := "NumpadDot"

Hotkey, ~*$%PixelLeft%, DoPixelLeft
Hotkey, ~*$%PixelRight%, DoPixelRight
Hotkey, ~*$%PixelUp%, DoPixelUp
Hotkey, ~*$%PixelDown%, DoPixelDown
HotKey, ~*$%ToggleNoRecoil%, DoToggleNoRecoil
HotKey, ~*$%DelayUp%, DoDelayUp
HotKey, ~*$%DelayDown%, DoDelayDown
HotKey, ~*$%PeriodUp%, DoPeriodUp
HotKey, ~*$%PeriodDown%, DoPeriodDown
HotKey, ~*$%LargeRecoilPreset%, GetFromINI
HotKey, ~*$%SmallRecoilPreset%, SaveToINI
HotKey, ~*$%MoveY%, DoMoveY
Hotkey, ~*$%ToggleHoldRightClick%, ToggleHoldRightClick 

TipRPS(PopupText)
{
    Gui, Destroy
    Gui, +AlwaysOnTop +ToolWindow -SysMenu -Caption
    Gui, Color, 000000
    WinSet, Transparent, 100
    Gui, Font, s8, norm, Verdana
    Gui, Add, Text, x5 y5 c00ff00, %PopupText%
    Gui, Show, NoActivate X0 Y36
}

TipOn(PopupText)
{   
    Gui, Destroy
    Gui, +AlwaysOnTop +ToolWindow -SysMenu -Caption
    Gui, Color, 000000
    WinSet, Transparent, 100
    Gui, Font, s8, norm, Verdana
    Gui, Add, Text, x5 y5 c00ff00, %PopupText%
    Gui, Show, NoActivate X0 Y18
}

TipOff(PopupText)
{
    Gui, Destroy 
    Gui, +AlwaysOnTop +ToolWindow -SysMenu -Caption
    Gui, Color, 000000
    WinSet, Transparent, 100
    Gui, Font, s8, norm, Verdana
    Gui, Add, Text, x5 y5 cff0000, %PopupText%
    Gui, Show, NoActivate X0 Y54
}

TipClear:
    loop
    {
        Gui, Destroy
        sleep 5000
    }
return

DoToggleNoRecoil:
    if NoRecoil < 1
    {
        NoRecoil += 1
        if NoRecoil = 1
        {
            SoundBeep, 800, 200
            TipOn("ON")
        }
    }
    else
    {
        NoRecoil := 0
        SoundBeep, 200, 100
        SoundBeep, 200, 100
        TipOff("OFF")
    }
return

DoPixelLeft:
    if pixelx < 10
        pixelx += 1
    TipOn("Pixel X Is " pixelX)
return

DoPixelRight:
    if pixelx > -10
        pixelx -= 1
    TipOn("Pixel X Is " pixelX)
return

DoPixelUp:
    if pixely < 50
        pixely += 1
    TipOn("Pixel Y Is " pixelY)
return

DoPixelDown:
    if pixely > 0
        pixely -= 1
    TipOn("Pixel Y Is " pixelY)
return

DoDelayUp:
    if rpm > 500
        rpm -= 10
    TipRPS("RPM: " rpm "  " "RPS:"  f(rpm)) 
return

DoDelayDown:
    if rpm < 1500
        rpm += 10
    TipRPS("RPM: " rpm "  " "RPS:"  f(rpm) )
return

DoPeriodUp:
    if period > 100
        period -= 100
    TipOn("PERIOD IS " period)
return

DoPeriodDown:
    if period < 6000
        period += 100
    TipOn("PERIOD IS " period)
return

GetFromINI:
{
    InputBox, WeaponCall, WeaponCall, , Show, 200, 100
    if ErrorLevel    
    
return

else
IniRead,pixely,%A_WorkingDir%\config.ini,%WeaponCall%,Y
IniRead,pixelx,%A_WorkingDir%\config.ini,%WeaponCall%,X
IniRead,rpm,%A_WorkingDir%\config.ini,%WeaponCall%,rpm
TipRPS(" Loaded!!    Weapon : " WeaponCall " " "Y : "pixely "  " "X : "pixelx "  "  "RPM : " rpm) 
}
sleep 4000
Gui, destroy
return
;put in name of weapon before write to INI, every preset can be saved seperate.

SaveToINI:   
{

    InputBox, WeaponSend, WeaponSend, , Show, 200, 100,
    if ErrorLevel    
    
return

else
IniWrite,%pixely%,%A_WorkingDir%\config.ini,%WeaponSend%,Y
IniWrite,%pixelx%,%A_WorkingDir%\config.ini,%WeaponSend%,X
IniWrite,%rpm%,%A_WorkingDir%\config.ini,%WeaponSend%,rpm
TipRPS(" Saved!!    Weapon :" WeaponSend " " "Y :" pixely "  " "X : " pixelx "  "  "RPM :" rpm)
}
sleep 4000
Gui, Destroy
return

DoMoveY: 
    if NoRecoil = 1    
    {
        xhair = 0
        enough = 0
        GetKeyState, state, LButton, P
        if state = U
            return
        sleep % f(rpm)
        loop
        {
            GetKeyState, state2, LButton, P
            if state2 = U
                break
            if enough = 1
                break
            DllCall("mouse_event", uint, 1, int, pixelx, int, pixely, uint, 0, int, 0)
            f(n)
            {   
                return Round(3600000/n/60)
            }
            sleep % f(rpm)    
        }
    }
return

ToggleHoldRightClick:
    toggle := !toggle
    if (toggle) {
        SetTimer, HoldRightClick, 10
        TipOn("Holding Right-click")
    } else {
        SetTimer, HoldRightClick, Off
        TipOff("Not Holding Right-click")
    }
return

HoldRightClick:
    holdingRightClick := false 
    Loop {
        GetKeyState, leftState, LButton, P
        GetKeyState, rightState, RButton, P
        
        if (leftState = "D") {
            if (!holdingRightClick) {
                Click, Down, Right
                holdingRightClick := true 
            }
        } else {
            if (holdingRightClick) {
                Click, Up, Right
                holdingRightClick := false 
            }
            break
        }
        
        Sleep, 10
    }
return

Interrupt:
    enough = 1
return

[Mod action: Moved topic to the “Gaming” section.]

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: kerzorath and 22 guests