[Tool] AutoHotkey scripts

OUTDATED there’s a better version without loop and sleeps using timers
Automatic camera (following your character)


b - rotate left
n - rotate right
~*LButton::
    KeyWait, LButton, T0.2 ;need to hold the button for 200ms to follow
    if ErrorLevel
    {         
        while GetKeyState("LButton", "P")
        {
            WinGetActiveStats, Title, Width, Height, X, Y
            MouseGetPos, xpos, ypos 
            xpos := xpos - Width/2 ;vector from the middle of the screen to the cursor
            ypos := Height/2 - ypos
            
            if xpos*xpos + ypos*ypos < 40000 ;<200 pix from center -> no rotation
                continue

            if (ypos > 0) and ( Abs(ATan(xpos / ypos)) * 57.29578 < 20) 
                continue ; 20° degrees from 12 o'clock -> 40° no rotation sector
            
            if xpos > 0 ;right half of screen -> rotate right
            {
                Send {n down}
                Sleep, 100 ; haven't tested other values here
                Send {n up}
            }
            else ;left half of screen -> rotate left
            {
                Send {b down}
                Sleep, 100
                Send {b up}
            }
            
            Sleep, 20
        }
    }
Return

[edit] added 200 pixel protection (no rotation if cursor is closer than 200 pixels to the middle of the screen) so that there’s no rotation during melee fights

[edit2] changing sector of no rotation near 12 o’clock from 10 x 2 = 20° to 20 x 2 = 40° degrees so that there’s less rotation and direction changes when moving upwards and changing direction only slightly; set this parameter to your liking

1 Like