Text Share Online

Ahk

#NoEnv

#SingleInstance, Force

#Persistent

#InstallKeybdHook

#UseHook

#KeyHistory, 0

#HotKeyInterval 1

#MaxHotkeysPerInterval 127

SetKeyDelay, -1, -1

SetControlDelay, -1

SetMouseDelay, -1

SetWinDelay, -1

SendMode, InputThenPlay

SetBatchLines, -1

ListLines, Off

CoordMode, Pixel, Screen

 

DllCall(“QueryPerformanceFrequency”, “Int64*”, perfFrequency)

lastMoveTime := 0

 

settingsFile := “sets.ini”

 

if (A_Args.Length() > 0)

    keybind := A_Args[1]

else

    IniRead, keybind, %settingsFile%, Config, keybind

 

MsgBox, Kairu successfully loaded! Press %keybind% to toggle and Del to exit.

 

IniRead, sensFactor, %settingsFile%, Config, sens_factor

IniRead, robloxFPS, %settingsFile%, Config, roblox_fps

IniRead, moveSpeedX, %settingsFile%, Config, move_speed_x

IniRead, moveSpeedY, %settingsFile%, Config, move_speed_y

IniRead, targetColor, %settingsFile%, Config, target_color

IniRead, fallbackColor, %settingsFile%, Config, fallback_color

IniRead, fovX, %settingsFile%, Config, fov_x

IniRead, fovY, %settingsFile%, Config, fov_y

IniRead, offsetX, %settingsFile%, Config, offset_x

IniRead, offsetY, %settingsFile%, Config, offset_y

IniRead, smoothness, %settingsFile%, Config, smoothness

IniRead, aimToggle, %settingsFile%, Config, aim_toggle, true

IniRead, aimLockToggle, %settingsFile%, Config, aim_lock_toggle, true

IniRead, colorSensitivity, %settingsFile%, Config, color_sensitivity

 

colorSensitivity += 0

if (colorSensitivity = “”)

    colorSensitivity := 10

 

sensFactor += 0, robloxFPS += 0, moveSpeedX += 0, moveSpeedY += 0

fovX += 0, fovY += 0, offsetX += 0, offsetY += 0, smoothness += 0

StringLower, aimToggle, aimToggle

StringLower, aimLockToggle, aimLockToggle

aimToggle := (aimToggle = “true”)

aimLockToggle := (aimLockToggle = “true”)

 

fovScale := 80

sensitivityMultiplier := 16363.64 / sensFactor

centerX := Floor(A_ScreenWidth // 2) – offsetX

centerY := Floor(A_ScreenHeight // 2) – offsetY

fovPxX := DegreesToPixels(fovX, fovScale, A_ScreenWidth)

fovPxY := DegreesToPixels(fovY, fovScale, A_ScreenHeight)

fovLeft := centerX – fovPxX

fovTop := centerY – fovPxY

fovRight := centerX + fovPxX

fovBottom := centerY + fovPxY

 

fallbackFOV_X := DegreesToPixels(2, fovScale, A_ScreenWidth)

fallbackFOV_Y := DegreesToPixels(2, fovScale, A_ScreenHeight)

fbLeft := centerX – fallbackFOV_X

fbTop := centerY – fallbackFOV_Y

fbRight := centerX + fallbackFOV_X

fbBottom := centerY + fallbackFOV_Y

fbSensitivity := 35

 

aimActive := false

 

Hotkey, % “*” . “~” . keybind, HandleKeyDown

Hotkey, % “*” . “~” . keybind . ” Up”, HandleKeyUp

 

SetTimer, MainLoop, 1

Return

 

MainLoop:

if (aimToggle && aimActive) {

    res := FindTarget(fovLeft, fovTop, fovRight, fovBottom, targetColor, colorSensitivity, fallbackColor, fbSensitivity)

    if (!res)

        res := FindTarget(fbLeft, fbTop, fbRight, fbBottom, targetColor, fbSensitivity, fallbackColor, fbSensitivity)

 

    if (res) {

        dx := res[1] – centerX

        dy := res[2] – centerY

        dist := Sqrt(dx ** 2 + dy ** 2)

        vx := (dist < 15) ? (moveSpeedX * 0.3) : moveSpeedX

        vy := (dist < 15) ? (moveSpeedY * 0.3) : moveSpeedY

        moveX := Floor(PixelsToDegrees(dx, fovScale, A_ScreenWidth) * (sensitivityMultiplier / 360) * vx)

        moveY := Floor(PixelsToDegrees(dy, fovScale, A_ScreenHeight) * (sensitivityMultiplier / 360) * vy)

        smoothMoveX := Floor(moveX * smoothness)

        smoothMoveY := Floor(moveY * smoothness)

        DllCall(“QueryPerformanceCounter”, “Int64*”, now)

        if (((now – lastMoveTime) / perfFrequency) * 1000 >= (1000 / robloxFPS)) {

            DllCall(“QueryPerformanceCounter”, “Int64*”, lastMoveTime)

            DllCall(“mouse_event”, “uint”, 0x0001, “int”, smoothMoveX, “int”, smoothMoveY, “uint”, 0, “int”, 0)

        }

    }

}

Return

 

HandleKeyDown:

if (!aimToggle)

    Return

if (aimLockToggle)

    aimActive := !aimActive

else

    aimActive := true

Return

 

HandleKeyUp:

if (!aimLockToggle)

    aimActive := false

Return

 

FindTarget(x1, y1, x2, y2, color1, tol1, color2 := “”, tol2 := 0) {

    PixelSearch, outX, outY, x1, y1, x2, y2, color1, tol1, Fast RGB

    if (!ErrorLevel)

        return [outX, outY]

    if (color2 != “”) {

        PixelSearch, outX, outY, x1, y1, x2, y2, color2, tol2, Fast RGB

        if (!ErrorLevel)

            return [outX, outY]

    }

    return false

}

 

PixelsToDegrees(deltaPx, fovDeg, screenWidth) {

    return RadToDeg(ATan(((deltaPx << 1) / screenWidth) * Tan(DegToRad(fovDeg * 0.5))))

}

 

DegreesToPixels(deg, fovDeg, screenWidth) {

    return screenWidth * 0.5 / Tan(DegToRad(fovDeg * 0.5)) * Tan(DegToRad(deg))

}

 

DegToRad(deg) {

    return deg * (4 * ATan(1)) / 180

}

 

RadToDeg(rad) {

    return rad * 180 / (4 * ATan(1))

}

 

Del::ExitApp

  • Ahk
  • none/plain text
  • Never
Share This: