Page 1 of 10 123 ... LastLast
Results 1 to 15 of 149
  1. #1
    fatdoobie's Avatar
    Join Date
    Jul 2018
    Gender
    male
    Posts
    159
    Reputation
    10
    Thanks
    511

    Post Forsaken Aim Assist Source Code

    Moving post-banwave discussion into this thread. The .exe files are all flagged, so don't run any of them.

    This is the 2.3 version. Use this at your own risk obviously. Requires AHK.


    1. Script WITH GUI and WITH INI FILES

    If you use this version, download my 2.3 zip file here: download

    Delete the exe file. The script should be the same as the source below, but just in case, this is the latest source:

    (for safety you should always make some changes)

    Code:
    #NoEnv
    #Persistent
    #SingleInstance, Force
    #KeyHistory, 0
    #InstallKeybdHook
    #InstallMouseHook
    #UseHook
    #HotKeyInterval 1 
    #MaxHotkeysPerInterval 127
    SetBatchLines,-1
    SetKeyDelay,-1, 8
    SetControlDelay, -1
    SetMouseDelay, 0
    SetWinDelay,0
    ListLines, Off
    Coordmode, mouse, screen
    SetWorkingDir, %A_Scriptdir%\res
    
    ; STATIC Globals. All auto-adjust is based off 1920x1080.
    g_W := A_Screenwidth
    g_H := A_Screenheight
    g_rw1 := Floor(g_W * 140 / 1920) ; max red W
    g_rh1 := Floor(g_H * 6 / 1080) ; min red H
    g_rw2 := Floor(g_W * 90 / 1920) ; mid red W
    g_rh2 := Floor(g_H * 8 / 1080) ; mid red H
    g_rw3 := Floor(g_W * 30 / 1920) ; min red W
    g_rh3 := Floor(g_H * 9 / 1080) ; max red H
    
    do_recoil := 0
    b := 0
    
    ; INI Files / GUI setup
    INI_Init("settings.ini")
    GoSub, trimImg
    GoSub, trimMain
    GoSub, g_scan
    GoSub, img_statics
    GoSub, LoadGUI
    GoSub, ShowGUI
    GoSub, UpdateMainGuiText
    
    ; HOTKEY setup
    Gui Hotkeys:Default
    loop, %hotkeys_keys% {
    	if (hotkeys_%A_Index% != "" && hotkeys_%A_Index% != "Not set") {
    		Hotkey, % hotkeys_%A_Index%, func_hotkeys%A_Index%
    	} else {
    		GuiControl, +cRed, hotkeys_%A_Index%
    		GuiControl,, hotkeys_%A_Index%, Not set
    	}
    }
    
    ; First launch
    if (etc_showonce = 1) {
    	etc_showonce := 0
    	INI_Save("settings.ini","etc")
    	Msgbox, 0, Welcome!, First launch detected! Running auto-adjust.`n`nYou can run auto-adjust any time by pressing Ctrl+Alt+F12
    	skipbox := 1
    	GoSub, AutoAdjust
    	Msgbox, 4, Set Hotkeys?, Would you like to set your toggle keys?`n`nYou can change them any time by pressing the 'hotkeys' button on the menu bar.
    	IfMsgBox, Yes
    		GoSub, ToggleHotkeyGui
    }
    
    ; -------------------- MAIN BOT LOOP ----------------------
    
    loop, {	
    	if ((GetKeyState("LButton","P")) && (main_anti = 1)) {
    		GoSub, mouseXY
    	}
    	if (b = 1) {
    		if ((GetKeyState("RButton", "P")) && (main_aimR = 1)) 
    		|| ((GetKeyState("LButton", "P")) && (main_aimL = 1)) 
    		|| ((GetKeyState(main_customkey, "P")) && (main_aimC = 1))
    		{
    			if (lockOn = "") {
    				GoSub, findTarget
    			} else {
    				GoSub, lockTarget
    			}
    			gosub, check_recoil
    			continue
    		}
    		if (ai = 1) {
    			gosub, g_scan
    		}
    	}	
    	gosub, check_recoil
    	Sleep, 1
    }
    return
    
    ; -------------------- End auto-execute --------------------
    
    ^!F12::
    AutoAdjust:
    if (skipbox != 1) {
    	Msgbox, 0, Auto-Adjusting!, Running auto adjust!
    }
    main_shake := Floor(g_W * 15 / 1920)
    main_aimX := Floor(g_W * 67 / 1920)
    main_aimY := Floor(g_H * 43 / 1080)
    img_WhiteH := Floor(g_H * 5 / 1080)
    img_WhiteW := 1
    img_GreyH := Floor(g_H * 5 / 1080)
    img_GreyW := 1
    trg_tX1 := Floor(g_W * 20 / 1920) 
    trg_tX2 := Floor(g_W * 20 / 1920)
    trg_tY1 := Floor(g_H * 10 / 1080)
    trg_tY2 := Floor(g_H * 30 / 1080)
    loop, %sections% {
    	sec := % s%A_Index%
    	INI_Save("settings.ini",sec)
    	INI_Load("settings.ini",sec)
    }
    file := "imgprofile\" . img_profile . ".ini"
    INI_Save(file,"img")
    file := "mainprofile\" . main_profile . ".ini"
    INI_Save(file,"main")
    return
    
    ; Hotkey funcs
    
    func_hotkeys1: ; master on / off
    Keywait, %hotkeys_1%, U
    lockOn := ""
    lock2 := ""
    b := !b
    l := 1 + b
    if (main_mute = 0) {
    	loop, %l% {
    		Soundbeep, 900, 100
    	}
    }
    Gui Main:Default
    Gui, submit, nohide
    GoSub, UpdateMainGuiText
    return
    
    func_hotkeys2: ; Y MODE, 0 = free, 1 = lock
    Keywait, %hotkeys_2%, Up
    main_yMode := !main_yMode
    IniWrite,%main_yMode%,settings.ini,main,yMode
    file := "mainprofile\" . main_profile . ".ini"
    Iniwrite,%main_yMode%,%file%,main,yMode
    Gosub, UpdateMainGuiText
    if (main_mute = 0) {
    	if (main_yMode = 1) {
    		loop, 2
    			Soundbeep, 700, 100
    	} else {
    		Soundbeep, 700, 100
    	}
    }
    return
    
    func_hotkeys3: ; 2nd Check, 1 = PVP, 2 = PVE, 3 = Both, 4 = None
    Keywait, %hotkeys_3%, Up
    if (main_PVMode < 4) {
    	main_PVMode ++
    	if (main_mute = 0) {
    		bf := 600 - (main_PVMode * 33)
    		Soundbeep, %bf%, 100
    	}
    } else {
    	main_PVMode := 1	
    	if (main_mute = 0) {
    		Soundbeep, 600, 100
    	}
    }
    Iniwrite,%main_PVMode%,settings.ini,main,PVMode
    file := "mainprofile\" . main_profile . ".ini"
    Iniwrite,%main_PVMode%,%file%,main,PVMode
    GoSub, UpdateMainGuiText
    return
    
    func_hotkeys4: ; Triggerbot on / off
    Keywait, %hotkeys_4%, Up
    main_trgMode := !main_trgMode
    iniwrite,%main_trgMode%,settings.ini,main,trgMode
    file := "mainprofile\" . main_profile . ".ini"
    Iniwrite,%main_trgMode%,%file%,main,trgMode
    GoSub, UpdateMainGuiText
    if (main_mute = 0) {
    	if (main_trgMode = 1) {
    		loop, 2 {
    			Soundbeep, 420, 100
    		}
    	} else {
    		Soundbeep, 420, 100
    	}
    }
    return
    
    func_hotkeys5: ; Anti-recoil on / off
    Keywait, %hotkeys_5%, Up
    main_anti := !main_anti
    iniwrite,%main_anti%,settings.ini,main,anti
    file := "mainprofile\" . main_profile . ".ini"
    Iniwrite,%main_anti%,%file%,main,anti
    GoSub, UpdateMainGuiText
    if (main_mute = 0) {
    	if (main_anti = 1) {
    		loop, 2 {
    			Soundbeep, 370, 100
    		}
    	} else {
    		Soundbeep, 370, 100
    	}
    }
    return
    
    ; ******************************************************************
    ; Main bot functions:
    
    g_scan: ; set normal scan area
    ai := 0
    X1 := 0 + (g_W * (main_scanX / 10))
    Y1 := 0 + (g_H * (main_scanY / 10))
    X2 := g_W - (g_W * (main_scanX / 10))
    Y2 := g_H - (g_H * (main_scanY / 10))
    return
    
    img_statics: ; only needs to be called on save/load
    t := 0 + img_timeout * 1000
    g_minv := Floor(g_W * (img_abs / 100) * 150 / 1920)
    return
    
    ai_scan: ; set "ai" scan area (tunnel vision)
    ai := 1
    X1 := aX - (g_W * 110 / 1920)
    X2 := aX + g_rw1 + (g_W * 110 / 1920)
    Y1 := aY - (g_H * 90 / 1080)
    Y2 := aY + g_rh2 + (g_H * 90 / 1080)
    return
    
    ai_timeout: ; force unlock
    timeout := 1
    lockOn := ""
    retry := 0
    return
    
    findTarget: ; first scan for red bars
    loop, 3 {
    	i := A_Index
    	v1 := "img_Red" . i . "t",v1:=%v1%
    	v2 := "g_rw" . i,v2:=%v2%
    	v3 := "g_rh" . i,v3:=%v3%
    	imagesearch, aX, aY, %X1%, %Y1%, %X2%, %Y2%, *%v1% *w%v2% *h%v3% bmp\1.bmp
    	if (ErrorLevel = 0) {
    		if (main_PVMode != 4) {
    			GoSub, scan2
    			if (ErrorLevel != 0) {
    				return
    			}
    		}
    		GoSub, mouse1
    		lockOn := i
    		retry := 0
    		GoSub, ai_scan
    		settimer, ai_timeout, -%t%
    		return
    	}
    }
    return
    
    lockTarget: ; lock on scan
    imagesearch, aX, aY, %X1%, %Y1%, %X2%, %Y2%, *%v1% *w%v2% *h%v3% bmp\1.bmp
    if (ErrorLevel = 0) {
    	if (main_PVMode != 4) {
    		GoSub, scan2
    		if (ErrorLevel != 0) {
    			return
    		}
    	}
    	GoSub, mouse1
    	lockOn := i
    	gosub, ai_scan
    	settimer, ai_timeout, -%t%
    	return	
    }
    gosub, g_scan
    if (lockOn = 1) {
    	retry := 0
    	lockOn := ""
    	return
    }
    if (v2 > g_minv) {
    	v2 := Floor(v2 * (100 - img_reduc) / 100) 
    }
    if (retry < img_loops) {
    	retry ++
    } else {
    	retry := 0
    	lockOn := ""
    }
    if (timeout = 1) {
    	timeout := 0
    	retry := 0
    	lockOn := ""
    }
    return
    
    scan2:
    if (main_PVMode = 1) { ; pvp mode
    	GoSub, scanB1
    	return
    } else if (main_PVMode = 2) { ; pve mode
    	GoSub, scanB2
    	return
    }
    loop, 2 { ; both mode
    	i2 := A_Index
    	if (lock2 = "" || lock2 = i2) {
    		Gosub, ScanB%i2%			
    		if (newX != "" && newY != "") {
    			lock2 := i2
    			return
    		}
    	}
    }
    lock2 := ""
    return
    
    scanB1: ; white search in level-text area
    newX1 := aX - Floor(g_W * 38 / 1920)
    newX2 := aX - Floor(g_W * 8 / 1920)
    newY1 := aY - Floor(g_H * 22 / 1080)
    newY2 := aY + Floor(g_H * 10 / 1080)
    imagesearch, newX, newY, %newX1%, %newY1%, %newX2%, %newY2%, *%img_WhiteT% *w%img_WhiteW% *h%img_WhiteH% bmp\2.bmp
    return
    
    scanB2: ; grey search in name area (eg "legionary")
    newX1 := aX - Floor(g_W * 3 / 1920)
    newX2 := aX + Floor(g_W * 55 / 1920)
    newY1 := aY - Floor(g_H * 23 / 1080)
    newY2 := aY - Floor(g_H * 3 / 1080)
    imagesearch, newX, newY, %newX1%, %newY1%, %newX2%, %newY2%, *%img_GreyT% *w%img_GreyW% *h%img_GreyH% bmp\3.bmp
    return
    
    mouse1: ; actual aim function
    AimX := aX - (g_W / 2 ) + main_aimX 
    AimY := aY - (g_H / 2 ) + main_aimY
    if (main_trgMode = 1 && doingClick != 1) {
    	if (AimX > -trg_tX1 && AimX < trg_tX2 && AimY > -trg_tY1 && AimY < trg_tY2) {
    		doingClick := 1
    		SetTimer, mouse2, -25
    	}
    }
    if (AimX > main_shake) {
    	DirX := main_sen / 10
    } else if (AimX > 0) {
    	DirX := main_sen / 15
    } else if (AimX < -main_shake) {
    	DirX := (-main_sen) / 10
    } else if (AimX < 0) {
    	DirX := (-main_sen) / 15
    }
    if (AimY > 0) {
    	DirY := main_sen / 12
    } else if (AimY < 0) {
    	DirY := (-main_sen) / 12
    }
    MoveX := Ceil(( AimX * DirX ** ( 1 ))) * DirX
    MoveY := Ceil(( AimY * DirY ** ( 1 ))) * DirY * main_yMode
    DllCall("mouse_event", uint, 1, int, MoveX, int, MoveY, uint, 0, int, 0) ; mouse move
    return
    
    mouse2:
    DllCall("mouse_event", uint, 2, int, x, int, y, uint, 0, int, 0) ; L button down
    if (main_anti = 1) {
    	GoSub, mouseXY
    }
    Random, r, 1, 1.2 ; 1 to 1.2 randomizer (never below hold time)
    d := trg_tFreq * r
    SetTimer, mouse3, -%d%
    return
    
    mouse3:
    DllCall("mouse_event", uint, 4, int, x, int, y, uint, 0, int, 0) ; L button up
    doingClick := 0
    return
    
    mouseXY: ; anti-recoil. Credits: Digi7aL.
    if (do_recoil = 0) {
    	do_recoil := 1
    	SetTimer, dorecoil, -25
    }
    return
    
    dorecoil:
    DllCall("mouse_event", uint, 1, int, main_antiX, int, main_antiY, uint, 0, int, 0)
    return
    
    check_recoil:
    if (do_recoil = 1) {
    	if !(GetKeyState("LButton","P")) {
    		do_recoil := 0	
    	}		
    }
    return
    
    
    
    ; **********************************************************************************************
    ; The rest of the script is just GUI and INI functions.
    
    
    ; ------ INI FUNCTIONS ------
    ; CREDITS: engunneer, edited by myself somewhat. 
    
    ; globals: sections, sNumber, section_keys, section_kNumber, section_key
    
    ; By default, these values should be:
    ; sections = 4
    ; s1 = main, etc
    ; main_keys = 14, etc
    ; main_k1 = sen, etc
    ; main_sen = 6, etc
    
    INI_Init(inifile) {
    	local key
    	sections := 0
    	loop, read, %inifile%
    	{
    		if (regexmatch(A_Loopreadline,"\[(\w+)]")) { ; line is a section name
    			sections+= 1
    			s%sections%:=regexreplace(A_loopreadline,"(\[)(\w+)(])","$2")
    			sec := s%sections%
    			%sec%_keys := 0
    			
    		} else if (regexmatch(A_LoopReadLine,"(\w+)=(.*)")) { ; line is a key=value pair
    			%sec%_keys+= 1
    			key:=%sec%_keys
    			%sec%_k%key%:=regexreplace(A_LoopReadLine,"(\w+)=(.*)","$1")
    			var:=sec "_" %sec%_k%key%
    			iniread,%var%,%inifile%,%sec%,% %sec%_k%key%
    		}
    	}
    }
    
    INI_Load(inifile,sec) { ; requires file location and section name
    	Gui %sec%:default
    	loop,% %sec%_keys
    	{
    		var := sec "_" %sec%_k%A_index%
    		iniread,temp,%inifile%,%sec%,% %sec%_k%A_index%
    		if (temp != "ERROR") {
    			%var% := temp
    			GuiControl,, %var%, % %var%
    		} else {
    			msgbox, Error loading settings value "%var%". Please select a new file:
    			GoSub, imgprofileLoad
    			break
    		}
    	}		
    }
    
    INI_Save(inifile,sec) { ; requires file location and section name
    	loop,% %sec%_keys
    	{
    		var:= sec "_" %sec%_k%A_index%,var2:=%var%
    		iniwrite,%var2%,%inifile%,%sec%,% %sec%_k%A_index%
    	}
    }
    return
    
    
    ; ------ GUI FUNCTIONS -----
    ; (lots of copy+pasted functions for similar things, if I get time I'll condense this all down a lot)
    ; original gui was from kivrin0's external bot 3.6
    ; warning: ugly code ahead
    
    SetHotKey:
    ID := A_Guicontrol
    SetCustomKey(temp,temperror)
    if (temperror = 0) {
    	loop, 4 {
    		v := hotkeys_%A_Index%
    		if (temp == v) {
    			msgbox, 16, Already in use, %v% is already in use. Please unbind it first.
    			return
    		}
    	}	
    	Gui Hotkeys:Default
    	if (hotkeys_%ID% != "" && hotkeys_%ID% != "Not set") {
    		Hotkey, % hotkeys_%ID%, off
    	}
    	hotkeys_%ID% := temp
    	INI_Save("settings.ini","hotkeys")
    	GuiControl, +cLime, hotkeys_%ID%
    	GuiControl,, hotkeys_%ID%, % hotkeys_%ID%
    	Hotkey, % hotkeys_%ID%, func_hotkeys%ID%, on
    }
    GoSub, UpdateMainGuiText
    return
    
    SetAimKey:
    SetCustomKey(temp,temperror)
    if (temperror = 0) {
    	main_customkey := temp
    	INI_Save("settings.ini","main")
    	Gui Main:Default
    	GuiControl,, main_customkey, %main_customkey%
    }
    return
    
    SetCustomKey(ByRef temp, ByRef temperror) {
    	global b
    	temperror := 0
    	if (b = 1) {
    		temperror := 1
    		msgbox, Please turn off the bot before changing custom key.
    		return
    	}
    	Mousegetpos, xpos, ypos
    	xpos += -50
    	prompt :=
    	(
    	"Please type the name of the key you wish to bind.`n
        A-Z, 0-9, F1-F99, Numpad0-Numpad9
        For other keys, type the literal key name (eg. CapsLock, PgDn, LCtrl, RAlt, etc)
        Mouse: MButton (middle), XButton1 (back), XButton2 (foward)`n"
    	)
    	InputBox, temp, Custom key, %prompt%, , 545, 225, %xpos%, %ypos%, , , 
    	if (ErrorLevel || temp = "") {
    		temperror := 1
    		return
    	}
    	Static ManualList := "CapsLock,Shift,LCtrl,RCtrl,LAlt,RAlt,Tab,Space,MButton,XButton1,XBUtton2,PgUp,PgDn,Ins,Home,Del,End,``,Enter,Up,Down,Left,Right,"
    	if temp not in %ManualList%
    	{
    		if !(StrLen(temp) = 1 && RegExMatch(temp,"[[:alnum:]]+",match))
    		&& !(StrLen(temp) < 4 && RegExMatch(temp,"i)F[[:digit:]]+",match))
    		&& !(StrLen(temp) = 7 && RegExMatch(temp,"i)Numpad[[:digit:]]",match)) 
    		{
    			temperror := 1
    			MsgBox, 16, Error!, "%temp%" may not be a valid key name.`nIt must be a single key name only.`nYou can attempt to enter the key name manually in the 'res\settings.ini' file if you want.
    			return
    		}
    	}
    	StringUpper, temp, temp, T
    }
    
    SaveMain:
    Gui Main:Default
    Gui submit, nohide
    INI_Save("settings.ini","main")
    GuiControl,, MainSaveText, Saved!
    SetTimer, RevertText, -1000
    if (drawing = 1) {
    	GoSub, UpdateOSD
    }
    gosub, g_scan
    return
    
    SaveImg:
    Gui Img:Default
    Gui submit, nohide
    INI_Save("settings.ini","img")
    file := "imgprofile\" . img_profile . ".ini"
    INI_Save(file,"img")
    GoSub, UpdateImg
    GuiControl,, ImgSaveText, Saved!
    SetTimer, RevertText, -1000
    GoSub, img_statics
    return
    
    SaveTrg:
    Gui Trg:Default
    Gui submit, nohide
    INI_Save("settings.ini","trg")
    GuiControl,, TrgSaveText, Saved!
    SetTimer, RevertText, -1000
    return
    
    imgprofileLoad:
    Thread, NoTimers
    FileSelectFile, SelectedFile, 3, imgprofile\, Open a file, Settings files (*.ini)
    Thread, NoTimers, false
    SplitPath, SelectedFile, name, dir, ext, name_no_ext, drive
    if (SelectedFile = "" || ext != "ini") {
    	return
    }
    img_profile := name_no_ext
    file := "imgprofile\" . img_profile . ".ini"
    INI_Load(file,"img")
    INI_Save("settings.ini","img")
    Gui Img:Default
    GoSub, UpdateImg
    GoSub, img_statics
    return
    
    imgprofileSaveAs:
    Thread, NoTimers
    FileSelectFile, SelectedFile, S, imgprofile\new.ini, Save as:, Settings files (*.ini)
    Thread, NoTimers, false
    if (SelectedFile = "") {
    	return
    }
    SplitPath, SelectedFile, name, dir, ext, name_no_ext, drive
    if (ext != "ini") {
       name=%name_no_ext%.ini
    }
    if (FileExist("imgprofile\"name)) {
    	Msgbox, 4, Are you sure?, Overwrite existing file?
    	IfMsgBox, No
    		return
    }
    img_profile := name_no_ext
    Gui Img:default
    Gui submit, nohide
    INI_Save("settings.ini","img")
    file := "imgprofile\" . img_profile . ".ini"
    INI_Save(file,"img")
    INI_Load(file,"img")
    GoSub, UpdateImg
    GoSub, img_statics
    return
    
    mainprofileLoad:
    Thread, NoTimers
    FileSelectFile, SelectedFile, 3, mainprofile\, Open a file, Settings files (*.ini)
    Thread, NoTimers, false
    SplitPath, SelectedFile, name, dir, ext, name_no_ext, drive
    if (SelectedFile = "" || ext != "ini") {
    	return
    }
    main_profile := name_no_ext
    file := "mainprofile\" . main_profile . ".ini"
    INI_Load(file,"main")
    INI_Save("settings.ini","main")
    Gui Main:Default
    GoSub, trimMain
    GuiControl,, mainprofileText, Profile: %mainString%
    Gosub, UpdateMainGuiText
    if (drawing = 1) {
    	GoSub, UpdateOSD
    }
    gosub, g_scan
    return
    
    mainprofileSaveAs:
    Thread, NoTimers
    FileSelectFile, SelectedFile, S, mainprofile\new.ini, Save as:, Settings files (*.ini)
    Thread, NoTimers, false
    if (SelectedFile = "") {
    	return
    }
    SplitPath, SelectedFile, name, dir, ext, name_no_ext, drive
    if (ext != "ini") {
       name=%name_no_ext%.ini
    }
    if (FileExist("mainprofile\"name)) {
    	Msgbox, 4, Are you sure?, Overwrite existing file?
    	IfMsgBox, No
    		return
    }
    main_profile := name_no_ext
    Gui Main:default
    Gui submit, nohide
    GoSub, trimMain
    GuiControl,, mainprofileText, Profile: %mainString%
    INI_Save("settings.ini","main")
    file := "mainprofile\" . main_profile . ".ini"
    INI_Save(file,"main")
    INI_Load(file,"main")
    Gosub, UpdateMainGuiText
    if (drawing = 1) {
    	GoSub, UpdateOSD
    }
    gosub, g_scan
    return
    
    tolShift:
    Gui Img:Default
    loop, 3
    {
    	var:= "img_Red" . A_index . "t",var2:=%var%
    	var2 += A_Guicontrol
    	GuiControl,, %var%, %var2%
    	img_Red%A_index%t := var2
    }
    return
    
    MainGuiToggle:
    Gui Main:Default
    if (miniMode != 1) {
    	miniMode := 1
    	Gui, Show, w270 h337 NoActivate, %WinTitle%
    	GuiControl,, MiniButton, ... (main)
    } else {
    	miniMode := 0
    	Gui, Show, w270 h133 NoActivate, %WinTitle%
    	GuiControl,, MiniButton, Main settings
    }
    return
    
    toggleIMG:
    if (!showingImgBox) {
    	GoSub, showImg
    } else {
    	GoSub, hideImg
    }
    return
    
    toggleOSD:
    if (drawing != 1) {
    	drawing := 1
    	GoSub, UpdateOSD
    } else { 
    	drawing := 0
    	Gui OSD:Default
    	Gui, Cancel
    }
    return
    
    toggleTrgGui:
    if (showingTrgBox != 1) {
    	GoSub, showTrg
    } else {
    	GoSub, hideTrg
    }
    return
    
    ToggleHotkeyGui:
    Gui Hotkeys:Default
    if (showingHotkeys != 1) {
    	showingHotkeys := 1
    	Mousegetpos, xpos, ypos
    	xpos += 10
    	ypos += 10
    	Gui, show, w225 h165 x%xpos% y%ypos%, Hotkeys:
    } else {
    	showingHotkeys := 0
    	Gui, cancel
    }
    return
    
    ImgGuiEscape:
    ImgGuiClose:
    GoSub, hideImg
    return
    
    TrgGuiEscape:
    TrgGuiClose:
    GoSub, hideTrg
    return
    
    HotkeysGuiEscape:
    HotkeysGuiClose:
    GoSub, ToggleHotkeyGui
    return
    
    Tray:
    Gui Main:Default
    WinHide
    return
    
    Restore:
    Gui Main:Default
    gui, Main: +lastfound
    WinShow
    WinRestore
    return
    
    MainGuiEscape:
    MainGuiClose:
    Exit:
    ExitApp
    return
    
    GuiMove:
    Gui Main:Default
    PostMessage, 0xA1, 2,,, A
    return
    
    MuteSub:
    main_mute := !main_mute
    Iniwrite, %main_mute%, settings.ini, main, mute
    return
    
    ; ------ OTHER GUI FUNCTIONS ------
    
    UpdateImg:
    Gui Img:Default
    GuiControl,, WhitePic, *w%img_WhiteW% *h%img_WhiteH% bmp\2.bmp
    GuiControl,, GreyPic, *w%img_GreyW% *h%img_GreyH% bmp\3.bmp
    return
    
    UpdateOSD:
    OSDx := 0 + (g_W * (main_scanX / 10))
    OSDy := 0 + (g_H * (main_scanY / 10))
    OSDw := g_W - (g_W * (main_scanX / 5))
    OSDh := g_H - (g_H * (main_scanY / 5))
    Gui OSD:Default
    Gui, Show, x%OSDx% y%OSDy% w%OSDw% h%OSDh% NoActivate
    Gui, +lastfound
    ID := WinExist()
    WinSet, ExStyle, +0x80020, ahk_id %ID%
    return
    
    showImg:
    showingImgBox := 1
    Gui Main:Default
    Gui,+LastFound
    GuiControl,, imgButton, ... (img)
    WinGetPos,newWinx,newWiny,newWinw,newWinh
    imgX := newWinx
    imgY := newWiny + newWinh
    Gui Img:Default
    Gui, Show, w250 h302 x%imgX% y%imgY%, %WinTitle%
    Sleep, 25
    GoSub, UpdateImg
    return
    
    hideImg:
    Gui Img:Default
    Gui, cancel
    showingImgBox := 0
    Gui Main:Default
    GoSub, trimImg
    GuiControl,, imgButton, img: %imgString%
    return
    
    trimImg:
    imgString := img_profile
    len := StrLen(img_profile)
    if (len > 6) {
    	trim := len - 5
    	StringTrimRight, imgString, imgString, %trim%
    	imgString := imgString . ".."
    }
    return
    
    trimMain:
    mainString := main_profile
    len := StrLen(mainString)
    if (len > 13) {
    	trim := len - 12
    	StringTrimRight, mainString, mainString, %trim%
    	mainString := mainString . ".."
    }
    return
    
    showTrg:
    showingTrgBox := 1
    Gui Main:Default
    Gui, +LastFound,
    GuiControl,, trgButton, ... (trg)
    WinGetPos,newWinX,newWiny,newWinw,newWinh
    trgGuiX := newWinx + newWinw
    trgGuiY := newWiny
    Gui Trg:Default
    Gui, Show, w248 h317 x%trgGuiX% y%trgGuiY%, %winTitle%
    return
    
    hideTrg:
    Gui Trg:Default
    Gui, cancel
    showingTrgBox := 0
    Gui Main:Default
    GuiControl,, trgButton, Triggerbot
    return
    
    RevertText:
    Gui Main:Default
    GuiControl,, MainSaveText, Save
    Gui Img:Default
    GuiControl,, ImgSaveText, Apply changes
    Gui Trg:Default
    GuiControl,, TrgSaveText, Save
    return
    
    UpdateMainGuiText:
    Gui Main:Default
    if (b = 1) { 
    	GuiControl, +cLime, OnOff
    	GuiControl,, OnOff, [%hotkeys_1%] Bot: ON
    } else {
    	GuiControl, +cRed, OnOff
    	GuiControl,, OnOff, [%hotkeys_1%] Bot: OFF	
    }
    if (main_yMode = 1) {
    	GuiControl, +cGreen, Ylock
    	GuiControl,, Ylock, [%hotkeys_2%] Y Mode: LOCK
    } else if (main_yMode = 0) {
    	GuiControl, +cMaroon, Ylock
    	GuiControl,, Ylock, [%hotkeys_2%] Y Mode: FREE
    }
    if (main_PVMode = 1) {
    	GuiControl, +cGreen, PVText
    	GuiControl,, PVText, [%hotkeys_3%] 2nd Check: PVP
    } else if (main_PVMode = 2) {
    	GuiControl, +cTeal, PVText
    	GuiControl,, PVText, [%hotkeys_3%] 2nd Check: PvE
    } else if (main_PVMode = 3) {
    	GuiControl, +cOlive, PVText
    	GuiControl,, PVText, [%hotkeys_3%] 2nd Check: Both
    } else if (main_PVMode = 4) {
    	GuiControl, +cMaroon, PVText
    	GuiControl,, PVText, [%hotkeys_3%] 2nd Check: None	
    }
    if (main_trgMode = 1) {
    	GuiControl, +cGreen, TrigText
    	GuiControl,, TrigText, [%hotkeys_4%] Triggerbot: ON
    } else {
    	GuiControl, +cMaroon, TrigText
    	GuiControl,, TrigText, [%hotkeys_4%] Triggerbot: OFF
    }
    if (main_anti = 1) {
    	GuiControl, +cGreen, AntiText
    	GuiControl,, AntiText, [%hotkeys_5%] Anti-Recoil: ON
    } else {
    	GuiControl, +cMaroon, AntiText
    	GuiControl,, AntiText, [%hotkeys_5%] Anti-Recoil: OFF
    }	
    return
    
    ;  Setup all GUIs on load:
    
    LoadGUI:
    ; main gui
    Gui Main:Default
    Gui, -Caption +Border
    Gui, Color, 000000
    Gui, Add, Picture, x0 y25 hwndhpic +0xE
    bgPic := "bmp\gui.bmp"
    hbmp := DllCall("LoadImage", "uint", 0, "str", bgPic, "uint", 0x0, "int", 0, "int", 0, "uint", 0x10|0x2000)
    SendMessage, 0x172, 0x0, hbmp,, ahk_id %hpic%
    Gui, Font, s10 cBlack
    Gui, Add, Text, x4 y4 w134 h21 gGuiMove cWhite, FAT AA 2.3
    Gui, Font, s8
    Gui, Add, Button, w60 h17 x138 y4 gToggleHotkeyGui, hotkeys
    Gui, Add, Button, w30 h17 x202 y4 gTray, tray
    Gui, Add, Button, w30 h17 x236 y4 gExit, exit
    Gui, Font, s9 cWhite
    Gui, Add, Button, w69 h28 x10 y35 gMainGuiToggle vMiniButton, Main settings
    Gosub, trimImg
    Gui, Add, Button, w69 h28 x10 y66 gtoggleIMG vimgButton, img: %imgString%
    Gui, Add, Button, w69 h28 x10 y97 gtoggleTrgGui vtrgButton, Triggerbot
    Gui, Font, s11
    Gui, Add, Text, w130 x85 y33 vOnOff cRed
    Gui, Add, Text, w130 x85 y52 vYlock
    Gui, Add, Text, w150 x85 y71 vPVText
    Gui, Add, Text, w170 x85 y90 vTrigText
    Gui, Add, Text, w170 x85 y109 vAntiText
    Gui, Font, s9
    Gui, Add, Checkbox, x218 y36 gMuteSub vMute Checked%main_mute%, Mute
    Gui, Font, s10 cWhite
    Gui, Add, Text, x37 y148, Speed:
    Gui, Add, Text, x13 y173, Anti-Shake:
    Gui, Add, Text, x44 y198, Aim X:
    Gui, Add, Text, x44 y223, Aim Y:
    Gui, Add, Text, x160 y148, Scan X:
    Gui, Add, Text, x160 y173, Scan Y:
    Gui, Add, Text, x152 y198, Recoil X:
    Gui, Add, Text, x152 y223, Recoil Y:
    Gui, Font, S11 cBlack
    Gui, Add, Edit, w35 h20 x90 y145 vmain_sen, %main_sen%
    Gui, Add, Edit, w35 h20 x90 y170 vmain_shake, %main_shake%
    Gui, Add, Edit, w35 h20 x90 y195 vmain_aimX, %main_aimX%
    Gui, Add, Edit, w35 h20 x90 y220 vmain_aimY, %main_aimY%
    Gui, Add, Edit, w35 h20 x215 y145 vmain_scanX, %main_scanX%
    Gui, Add, Edit, w35 h20 x215 y170 vmain_scanY, %main_scanY%
    Gui, Add, Edit, w35 h20 x215 y195 vmain_antiX, %main_antiX%
    Gui, Add, Edit, w35 h20 x215 y220 vmain_antiY, %main_antiY%
    Gui, Font, s9 cWhite
    Gui, Add, Text, x10 y250, Activate:
    Gui, Add, Checkbox, x56 y250 vmain_aimL checked%main_aimL%, L Click
    Gui, Add, Checkbox, x115 y250 vmain_aimR checked%main_aimR%, R Click
    Gui, Add, Checkbox, w20 h20 x178 y247 vmain_aimC checked%main_aimC% -wrap, %A_space%
    Gui, Font, s9
    Gui, Add, Button, w56 h20 x198 y247 gSetAimKey vmain_customKey, %main_customkey%
    Gui, Add, Checkbox, x30 y277 gtoggleOSD, Draw Scan Area
    Gui, Add, Text, x145 y277 cLime w115 vmainprofileText, Profile: %mainString%
    Gui, Add, Button, w65 h19 x20 y300 gmainprofileSaveAs, Save As...
    Gui, Add, Button, w50 h19 x90 y300 gmainprofileLoad, Load
    Gui, Add, Button, w105 h19 x145 y300 gSaveMain vMainSaveText Default, Save
    Gui, +Lastfound
    Menu, Tray, NoStandard
    Menu, Tray, Add, Exit, Exit
    Menu, Tray, Add, Restore, Restore
    Menu, Tray, Default, Restore
    Menu, Tray, Click, 2
    ; imagesearch gui
    Gui Img:Default
    Gui, Color, 000000
    Gui, Add, Picture, x0 y0 hwndhpic2 +0xE
    ImgbgPic := "bmp\imgGui.bmp"
    hbmp := DllCall("LoadImage", "uint", 0, "str", ImgbgPic, "uint", 0x0, "int", 0, "int", 0, "uint", 0x10|0x2000)
    SendMessage, 0x172, 0x0, hbmp,, ahk_id %hpic2%
    Gui, Font, s9
    Gui, Add, Text, w70 h20 x67 y10 cWhite vimg_profile, %img_profile%
    Gui, Add, Button, h20 w140 x7 y31 gSaveImg vImgSaveText Default, Apply changes
    Gui, Add, Button, h18 w70 x165 y9 gimgprofileLoad, Load
    Gui, Add, Button, h18 w70 x165 y33 gimgprofileSaveAs, Save As...
    Gui, Font, s9 cWhite
    Gui, Add, Text, x55 y70, Retry Limit:
    Gui, Add, Text, x51 y92, Aggression:
    Gui, Add, Text, x44 y114, Minimum HP:
    Gui, Add, Text, x34 y136, Memory length:
    Gui, Add, Text, x145 y70, attempts
    Gui, Add, Text, x145 y92, `%
    Gui, Add, Text, x145 y114, `%
    Gui, Add, Text, x145 y136, seconds
    Gui, Font, cBlack
    Gui, Add, Edit, x113 y68 h17 w25 vimg_loops, %img_loops%
    Gui, Add, Edit, x113 y90 h17 w25 vimg_reduc, %img_reduc%
    Gui, Add, Edit, x113 y112 h17 w25 vimg_abs, %img_abs% 
    Gui, Add, Edit, x113 y134 h17 w25 vimg_timeout, %img_timeout%
    Gui, Font, s11
    Gui, Add, Text, x25 y177 cRed, Color Tolerance:
    Gui, Font, s9
    Gui, Add, Button, h16 w24 x69 y200 gtolShift, -5
    Gui, Add, Button, h16 w24 x99 y200 gtolShift, +5
    Gui, Add, Text, x178 y168 cRed, High HP
    Gui, Add, Text, x178 y193 cRed, Mid HP
    Gui, Add, Text, x178 y218 cRed, Low HP
    Gui, Font, s10 cBlack
    Gui, Add, Edit, x138 y165 w30 h18 vimg_Red1t, %img_Red1t% 
    Gui, Add, Edit, x138 y190 w30 h18 vimg_Red2t, %img_Red2t%
    Gui, Add, Edit, x138 y215 w30 h18 vimg_Red3t, %img_Red3t%
    Gui, Font, cWhite
    Gui, Add, Text, w96 h18 x26 y240, White (PvP):
    Gui, Add, Text, w92 h18 x155 y240, Grey (PvE):
    Gui, Font, s9
    Gui, Add, Text, x20 y259, Tolerance:
    Gui, Add, Text, x15 y279, W:
    Gui, Add, Text, x60 y279, H:
    Gui, Add, Text, x140 y259, Tolerance:
    Gui, Add, Text, x135 y279, W:
    Gui, Add, Text, x180 y279, H:
    Gui, Font, s9 cBlack
    Gui, Add, Picture, x105 y245 w2 h2 vwhitepic, bmp\2.bmp
    Gui, Add, Edit, w20 h16 x76 y260 vimg_WhiteT, %img_WhiteT%
    Gui, Add, Edit, w20 h16 x32 y278 vimg_WhiteW, %img_WhiteW%
    Gui, Add, Edit, w20 h16 x76 y278 vimg_whiteH, %img_WhiteH%
    Gui, Font, s10 cSilver
    Gui, Font, s9 cBlack
    Gui, Add, Picture, x228 y245 w2 h2 vgreypic, bmp\3.bmp
    Gui, Add, Edit, w25 h16 x197 y260 vimg_GreyT, %img_GreyT%
    Gui, Add, Edit, w25 h16 x151 y278 vimg_GreyW, %img_GreyW%
    Gui, Add, Edit, w25 h16 x197 y278 vimg_GreyH, %img_GreyH%
    ; Trigger gui
    Gui Trg:Default
    Gui, Color, 000000
    Gui, Add, Picture, x0 y0 hwndhpic3 +0xE
    TrgbgPic := "bmp\trgGui.bmp"
    hbmp := DllCall("LoadImage", "uint", 0, "str", TrgbgPic, "uint", 0x0, "int", 0, "int", 0, "uint", 0x10|0x2000)
    SendMessage, 0x172, 0x0, hbmp,, ahk_id %hpic3%
    Gui, Add, Button, Default gSaveTrg vTrgSaveText w100 h20 x75 y45, Save
    Gui, Font, cWhite s10
    Gui, Add, Text, x36 y84, Hold time / fire rate: 
    Gui, Add, Text, h22 x190 y85, ms 
    Gui, Font, cBlack 
    Gui, Add, Edit, w30 h20 x155 y82 vtrg_tFreq, %trg_tFreq%
    Gui, Font, cRed
    Gui, Add, Text, x72 y110, Trigger fire zone:
    Gui, font, s9 cWhite
    Gui, Add, Text, x29 y140, X1 (left): 
    Gui, Add, Text, x138 y140, X2 (right): 
    Gui, Add, Text, x29 y170, Y1 (up):
    Gui, Add, Text, x130 y170, Y2 (down): 
    Gui, font, cBlack
    Gui, Add, Edit, w22 h18 x79 y138 vtrg_tX1, %trg_tX1%
    Gui, Add, Edit, w22 h18 x196 y138 vtrg_tX2, %trg_tX2%
    Gui, Add, Edit, w22 h18 x79 y167 vtrg_tY1, %trg_tY1%
    Gui, Add, Edit, w22 h18 x196 y167 vtrg_tY2, %trg_tY2%
    ; hotkey gui
    Gui Hotkeys:Default
    Gui, Color, 000000
    Gui, Font, cWhite s10
    Gui, Add, Text, x10 y10, Set your toggle keys:
    Gui, Add, Text, x10 y50, Main On / Off:
    Gui, Add, Text, x10 y70, Y Mode:
    Gui, Add, Text, x10 y90, 2nd Check:
    Gui, Add, Text, x10 y110, Triggerbot:
    Gui, Add, Text, x10 y130, Anti-Recoil:
    Gui, Font, cLime s10
    Gui, Add, Text, w65 x110 y50 vhotkeys_1, %hotkeys_1%
    Gui, Add, Text, w65 x110 y70 vhotkeys_2, %hotkeys_2%
    Gui, Add, Text, w65 x110 y90 vhotkeys_3, %hotkeys_3%
    Gui, Add, Text, w65 x110 y110 vhotkeys_4, %hotkeys_4%
    Gui, Add, Text, w65 x110 y130 vhotkeys_5, %hotkeys_5%
    Gui, font, cBlack s9 
    Gui, Add, Button, h18 w30 x180 y50 gSetHotKey, 1
    Gui, Add, Button, h18 w30 x180 y70 gSetHotKey, 2
    Gui, Add, Button, h18 w30 x180 y90 gSetHotKey, 3
    Gui, Add, Button, h18 w30 x180 y110 gSetHotKey, 4
    Gui, Add, Button, h18 w30 x180 y130 gSetHotKey, 5
    ; OSD (draw scan area)
    Gui OSD:Default 
    Gui, +AlwaysOnTop -Caption +ToolWindow +Border -DPIScale
    Gui, Color, EEAA99
    Gui, +Lastfound
    WinSet, TransColor, EEAA99
    return
    
    ShowGUI:
    Random, r, 5, 10
    Loop %r% {
    	Random, Var,97,122
    	WinTitle.=Chr(Var)
    }
    mousegetpos, xpos, ypos
    xpos += -50
    ypos += -50
    Gui Main:default
    Gui, Show, w270 h133 x%xpos% y%ypos%, %WinTitle%
    return
    
    ; end

    2. Script WITHOUT GUI and WITHOUT INI FILES

    Make a fresh new folder with nothing in it. We are going to put the script and the 3 .bmp files inside it, no subfolders.

    You can either download the 2.3 zip (here) and grab the .bmp files from it (apart from the gui images), or save these ones below.

    Imgur rehosts these as .png, so make sure you save them in paint as "1.bmp", "2.bmp" and "3.bmp".


    1 [ ] 2 [ ] | 3 [ ]


    Standalone script

    Put this in the SAME folder as the above images, edit the source to change your settings (at the top), press F12 to reload.

    Code:
    #NoEnv
    #Persistent
    #SingleInstance, Force
    #KeyHistory, 0
    #InstallKeybdHook
    #InstallMouseHook
    #UseHook
    #HotKeyInterval 1 
    #MaxHotkeysPerInterval 127
    SetBatchLines,-1
    SetKeyDelay,-1, 8
    SetControlDelay, -1
    SetMouseDelay, 0
    SetWinDelay,0
    ListLines, Off
    Coordmode, mouse, screen
    SetWorkingDir, %A_Scriptdir%
    
    ; [hotkeys]
    
    hkey_1 := "F3" ; main on off
    hkey_2 := "F4" ; y mode
    hkey_3 := "F5" ; 2nd check
    hkey_4 := "F6" ; triggerbot
    hkey_5 := "F7" ; anti-recoil
    
    yMode := 1		; default Y mode (0 = free, 1 = lock)
    PVMode := 1		; default 2nd check mode (1 = PvP, 2 = PvE, 3 = Both, 4 = None)
    anti := 0		; default recoil mode (0 = off, 1 = on)
    trgMode := 0	; default triggerbot mode (0 = off, 1 = on)
    
    mute := 0
    
    
    ; [Activate keys]
    
    aimL := 1 ; left mouse
    aimR := 1 ; right mouse
    
    aimC := 1 ; custom
    customkey := "Not Set" ; Any single key or mouse button
    
    
    ; [main]
    sen := 7		; aim speed
    shake := 15		; anti-shake area
    scanX := 3.6	; scan area width
    scanY := 3.5	; scan area height
    u_aimX := 67	; X aim offset
    u_aimY := 43	; Y aim offset
    antiX := 0		; recoil X offset	
    antiY := 30 	; recoil Y offset	
    
    ; [img]
    loops := 4		; retry limit
    reduc := 2		; aggression
    timeout := 1	; memory length
    abs_min := 10	; absolute minimum HP
    
    Red1t := 45		; HIGH HP tolerance
    Red2t := 40		; MID HP tolerance
    Red3t := 35		; LOW HP tolerance
    
    WhiteW := 1		; White Width	
    WhiteH := 5		; White Height
    WhiteT := 25	; White Tolerance
    
    GreyW := 1		; Grey Width
    GreyH := 5		; Grey Height
    GreyT := 30		; Grey Tolerance
    
    ; [trg]
    tFreq := 125	; Trigger speed / hold time
    tX1 := 20		; X1
    tY1 := 10		; Y1
    tX2 := 20		; X2
    tY2 := 30		; Y2
    
    
    ; ----------------------------------------------------------
    ; STATIC Globals. All auto-adjust is based off 1920x1080.
    g_W := A_Screenwidth
    g_H := A_Screenheight
    g_rw1 := Floor(g_W * 140 / 1920) ; max red W
    g_rh1 := Floor(g_H * 6 / 1080) ; min red H
    g_rw2 := Floor(g_W * 90 / 1920) ; mid red W
    g_rh2 := Floor(g_H * 8 / 1080) ; mid red H
    g_rw3 := Floor(g_W * 30 / 1920) ; min red W
    g_rh3 := Floor(g_H * 9 / 1080) ; max red H
    
    GoSub, g_scan
    GoSub, statics
    do_recoil := 0
    b := 0
    
    ; HOTKEY setup
    loop, 5 {
    	if (hkey_%A_Index% != "" && hkey_%A_Index% != "Not set") {
    		Hotkey, % hkey_%A_Index%, func_hotkeys%A_Index%
    	}
    }
    
    ; -------------------- MAIN BOT LOOP ----------------------
    
    loop, {	
    	if ((GetKeyState("LButton","P")) && (anti = 1)) {
    		GoSub, mouseXY
    	}
    	if (b = 1) {
    		if ((GetKeyState("RButton", "P")) && (aimR = 1)) 
    		|| ((GetKeyState("LButton", "P")) && (aimL = 1)) 
    		|| ((GetKeyState(customkey, "P")) && (aimC = 1))
    		{
    			if (lockOn = "") {
    				GoSub, findTarget
    			} else {
    				GoSub, lockTarget
    			}
    			gosub, check_recoil
    			continue
    		}
    		if (ai = 1) {
    			gosub, g_scan
    		}
    	}	
    	gosub, check_recoil
    	Sleep, 1
    }
    return
    
    
    F12::
    reload
    return
    
    ; -------------------- End auto-execute --------------------
    
    ; ******************************************************************
    ; Main bot functions:
    
    g_scan: ; set normal scan area
    ai := 0
    X1 := 0 + (g_W * (scanX / 10))
    Y1 := 0 + (g_H * (scanY / 10))
    X2 := g_W - (g_W * (scanX / 10))
    Y2 := g_H - (g_H * (scanY / 10))
    return
    
    statics: ; only needs to be called on save/load
    t := 0 + timeout * 1000
    g_minv := Floor(g_W * (abs_min / 100) * 150 / 1920)
    return
    
    ai_scan: ; set "ai" scan area (tunnel vision)
    ai := 1
    X1 := aX - (g_W * 110 / 1920)
    X2 := aX + g_rw1 + (g_W * 110 / 1920)
    Y1 := aY - (g_H * 90 / 1080)
    Y2 := aY + g_rh2 + (g_H * 90 / 1080)
    return
    
    ai_timeout: ; force unlock
    timeout := 1
    lockOn := ""
    retry := 0
    return
    
    findTarget: ; first scan for red bars
    loop, 3 {
    	i := A_Index
    	v1 := "Red" . i . "t",v1:=%v1%
    	v2 := "g_rw" . i,v2:=%v2%
    	v3 := "g_rh" . i,v3:=%v3%
    	imagesearch, aX, aY, %X1%, %Y1%, %X2%, %Y2%, *%v1% *w%v2% *h%v3% 1.bmp
    	if (ErrorLevel = 0) {
    		if (PVMode != 4) {
    			GoSub, scan2
    			if (ErrorLevel != 0) {
    				return
    			}
    		}
    		GoSub, mouse1
    		lockOn := i
    		retry := 0
    		GoSub, ai_scan
    		settimer, ai_timeout, -%t%
    		return
    	}
    }
    return
    
    lockTarget: ; lock on scan
    imagesearch, aX, aY, %X1%, %Y1%, %X2%, %Y2%, *%v1% *w%v2% *h%v3% 1.bmp
    if (ErrorLevel = 0) {
    	if (PVMode != 4) {
    		GoSub, scan2
    		if (ErrorLevel != 0) {
    			return
    		}
    	}
    	GoSub, mouse1
    	lockOn := i
    	gosub, ai_scan
    	settimer, ai_timeout, -%t%
    	return	
    }
    gosub, g_scan
    if (lockOn = 1) {
    	retry := 0
    	lockOn := ""
    	return
    }
    if (v2 > g_minv) {
    	v2 := Floor(v2 * (100 - reduc) / 100) 
    }
    if (retry < loops) {
    	retry ++
    } else {
    	retry := 0
    	lockOn := ""
    }
    if (timeout = 1) {
    	timeout := 0
    	retry := 0
    	lockOn := ""
    }
    return
    
    scan2:
    if (PVMode = 1) { ; pvp mode
    	GoSub, scanB1
    	return
    } else if (PVMode = 2) { ; pve mode
    	GoSub, scanB2
    	return
    }
    loop, 2 { ; both mode
    	i2 := A_Index
    	if (lock2 = "" || lock2 = i2) {
    		Gosub, ScanB%i2%			
    		if (newX != "" && newY != "") {
    			lock2 := i2
    			return
    		}
    	}
    }
    lock2 := ""
    return
    
    scanB1: ; white search in level-text area
    newX1 := aX - Floor(g_W * 38 / 1920)
    newX2 := aX - Floor(g_W * 8 / 1920)
    newY1 := aY - Floor(g_H * 22 / 1080)
    newY2 := aY + Floor(g_H * 10 / 1080)
    imagesearch, newX, newY, %newX1%, %newY1%, %newX2%, %newY2%, *%WhiteT% *w%WhiteW% *h%WhiteH% 2.bmp
    return
    
    scanB2: ; grey search in name area (eg "legionary")
    newX1 := aX - Floor(g_W * 3 / 1920)
    newX2 := aX + Floor(g_W * 55 / 1920)
    newY1 := aY - Floor(g_H * 23 / 1080)
    newY2 := aY - Floor(g_H * 3 / 1080)
    imagesearch, newX, newY, %newX1%, %newY1%, %newX2%, %newY2%, *%GreyT% *w%GreyW% *h%GreyH% 3.bmp
    return
    
    mouse1: ; actual aim function
    AimX := aX - (g_W / 2 ) + u_aimX 
    AimY := aY - (g_H / 2 ) + u_aimY
    if (trgMode = 1 && doingClick != 1) {
    	if (AimX > -tX1 && AimX < tX2 && AimY > -tY1 && AimY < tY2) {
    		doingClick := 1
    		SetTimer, mouse2, -25
    	}
    }
    if (AimX > shake) {
    	DirX := sen / 10
    } else if (AimX > 0) {
    	DirX := sen / 15
    } else if (AimX < -shake) {
    	DirX := (-sen) / 10
    } else if (AimX < 0) {
    	DirX := (-sen) / 15
    }
    if (AimY > 0) {
    	DirY := sen / 12
    } else if (AimY < 0) {
    	DirY := (-sen) / 12
    }
    MoveX := Ceil(( AimX * DirX ** ( 1 ))) * DirX
    MoveY := Ceil(( AimY * DirY ** ( 1 ))) * DirY * yMode
    DllCall("mouse_event", uint, 1, int, MoveX, int, MoveY, uint, 0, int, 0) ; mouse move
    return
    
    mouse2:
    DllCall("mouse_event", uint, 2, int, x, int, y, uint, 0, int, 0) ; L button down
    if (anti = 1) {
    	GoSub, mouseXY
    }
    Random, r, 1, 1.2 ; 1 to 1.2 randomizer (never below hold time)
    d := tFreq * r
    SetTimer, mouse3, -%d%
    return
    
    mouse3:
    DllCall("mouse_event", uint, 4, int, x, int, y, uint, 0, int, 0) ; L button up
    doingClick := 0
    return
    
    mouseXY: ; anti-recoil. Credits: Digi7aL.
    if (do_recoil = 0) {
    	do_recoil := 1
    	SetTimer, dorecoil, -25
    }
    return
    
    dorecoil:
    DllCall("mouse_event", uint, 1, int, antiX, int, antiY, uint, 0, int, 0)
    return
    
    check_recoil:
    if (do_recoil = 1) {
    	if !(GetKeyState("LButton","P")) {
    		do_recoil := 0	
    	}		
    }
    return
    
    ; *************************************
    ; Hotkey funcs
    
    func_hotkeys1: ; master on / off
    Keywait, %hkey_1%, U
    lockOn := ""
    lock2 := ""
    b := !b
    l := 1 + b
    if (mute = 0) {
    	loop, %l% {
    		Soundbeep, 900, 100
    	}
    }
    return
    
    func_hotkeys2: ; Y MODE, 0 = free, 1 = lock
    Keywait, %hkey_2%, Up
    yMode := !yMode
    if (mute = 0) {
    	if (yMode = 1) {
    		loop, 2
    			Soundbeep, 700, 100
    	} else {
    		Soundbeep, 700, 100
    	}
    }
    return
    
    func_hotkeys3: ; 2nd Check, 1 = PVP, 2 = PVE, 3 = Both, 4 = None
    Keywait, %hkey_3%, Up
    if (PVMode < 4) {
    	PVMode ++
    	if (mute = 0) {
    		bf := 600 - (PVMode * 33)
    		Soundbeep, %bf%, 100
    	}
    } else {
    	PVMode := 1	
    	if (mute = 0) {
    		Soundbeep, 600, 100
    	}
    }
    return
    
    func_hotkeys4: ; Triggerbot on / off
    Keywait, %hkey_4%, Up
    trgMode := !trgMode
    if (mute = 0) {
    	if (trgMode = 1) {
    		loop, 2 {
    			Soundbeep, 420, 100
    		}
    	} else {
    		Soundbeep, 420, 100
    	}
    }
    return
    
    func_hotkeys5: ; Anti-recoil on / off
    Keywait, %hkey_5%, Up
    anti := !anti
    if (mute = 0) {
    	if (anti = 1) {
    		loop, 2 {
    			Soundbeep, 370, 100
    		}
    	} else {
    		Soundbeep, 370, 100
    	}
    }
    return
    
    ; end

  2. The Following 4 Users Say Thank You to fatdoobie For This Useful Post:

    elflin1024 (10-21-2018),junomech (10-22-2018),Masbka (10-21-2018),Scromb (10-22-2018)

  3. #2
    whothatmofo1's Avatar
    Join Date
    Oct 2018
    Gender
    male
    Posts
    17
    Reputation
    10
    Thanks
    1
    so is the scripted without exe detected or not?? im so confused as to what is going on and how some people are banned and others are not.

  4. #3
    fatdoobie's Avatar
    Join Date
    Jul 2018
    Gender
    male
    Posts
    159
    Reputation
    10
    Thanks
    511
    As far as we can tell, running the .ahk script directly is much less likely to get you banned. For more safety, make some changes to it. If you don't know what you're doing then your best option is to not use it. Not banned myself, I know of plenty others who aren't either.

    However it is the nature of any public script or exe that it will probably get detected sooner or later, especially the more people that are using it. So the more different your version is to everyone else's, the safer you'll be.
    Last edited by fatdoobie; 10-20-2018 at 11:15 PM.

  5. #4
    hydrolisk's Avatar
    Join Date
    Oct 2018
    Gender
    male
    Posts
    10
    Reputation
    10
    Thanks
    2

    vouch for not banned.

    https://www.reddi*****m/r/DestinyTheG...g_around_that/

    might want to consider some privacy yourself doob :/
    just stumbled on this.
    Last edited by hydrolisk; 10-21-2018 at 01:43 AM.

  6. #5
    fatdoobie's Avatar
    Join Date
    Jul 2018
    Gender
    male
    Posts
    159
    Reputation
    10
    Thanks
    511
    Quote Originally Posted by hydrolisk View Post
    https://www.reddi*****m/r/DestinyTheG...g_around_that/

    might want to consider some privacy yourself doob :/
    just stumbled on this.
    That's 4 months old, before I even released anything on here

    But yes, reddit and youtube are well aware of us, hence the banwave.

  7. #6
    hydrolisk's Avatar
    Join Date
    Oct 2018
    Gender
    male
    Posts
    10
    Reputation
    10
    Thanks
    2

    Eh

    Have you considered making a private version and selling it with built in security features like figuring out proprietary file structure for different objects. I would be interested.

  8. #7
    fatdoobie's Avatar
    Join Date
    Jul 2018
    Gender
    male
    Posts
    159
    Reputation
    10
    Thanks
    511
    I have considered that, but I'm not about to quit my job for this, and I don't have enough free time for that. So I'm happy to provide an improved version of the same ahk script that has been going around for a year now, since I'm doing that for myself anyway, and I know the risk of getting myself banned won't change.

    The situation we have is the same as it was at launch - running a unique .ahk script is pretty much undetectable, but if you run an .exe that is more or less identical to everyone else, you'll get banned. Starlord had fairly sophisticated protection but Bungie found him every time, so yeah, I doubt I can figure out better protection than him.

    Anyway tl;dr, do it yourself with the .ahk file directly and it's safer than anything else. Rely on others or use .exe's and expect a ban.
    Last edited by fatdoobie; 10-21-2018 at 02:56 AM.

  9. #8
    TearL2's Avatar
    Join Date
    Nov 2015
    Gender
    female
    Posts
    43
    Reputation
    10
    Thanks
    2
    I can make this undetected. But what's the current performance of that?

  10. #9
    fatdoobie's Avatar
    Join Date
    Jul 2018
    Gender
    male
    Posts
    159
    Reputation
    10
    Thanks
    511
    Quote Originally Posted by TearL2 View Post
    I can make this undetected. But what's the current performance of that?
    Of the script? Its ok, nowhere near as good as pre-forsaken though. Only way to really improve it would be to read memory instead of imagesearch.

  11. #10
    Masbka's Avatar
    Join Date
    Feb 2015
    Gender
    male
    Location
    Mother Russia
    Posts
    44
    Reputation
    10
    Thanks
    15
    My Mood
    Drunk
    Only a way to read memory very difficult and expensive, to make it safe.

  12. #11
    Nukez15's Avatar
    Join Date
    Oct 2015
    Gender
    male
    Posts
    5
    Reputation
    10
    Thanks
    6
    My Mood
    Asleep

    This might add an extra protection, as I have not been banned.

    The purpose of this script is whenever you launch it, it will create a duplicate .ahk of fatdoobies .ahk but with a random string of letters as its name. Whenever you close the duplicated file, it will self destruct and delete itself leaving you only with the orignial .ahk and this .ahk

    Credits to Kivrin0, as this is basically his loader from the pre-forsaken script.

    Create a second .ahk file in the same folder as the main script. Name it whatever you want and put this code in it:
    Make sure you change test.ahk to name of fatdoobie's .ahk file. (if you changed the name of his file, then use that name).
    USE CTRL+F to find "test.ahk"
    Code:
    #NoEnv
    #SingleInstance, Force
    Menu, Tray, NoStandard
    
    ; ---------- failsafe stuff
    
    if !FileExist("test.ahk") {												; make sure test.ahk exists
    	Msgbox, test.ahk not found! Please replace it.
    	ExitApp
    }
    SetWorkingDir, %A_ScriptDir%\res										; make sure settings exists
    if !FileExist(A_WorkingDir "\settings.ini") {
    	Msgbox, Settings file not found! loading defaults...				; if not, load defaults
    	FileAppend,
    (
    [main]
    profile=default
    sen=7
    shake=15
    scanX=3.6
    scanY=3.5
    aimX=67
    aimY=43
    antiX=0
    antiY=40
    PVMode=1
    yMode=1
    anti=0
    trgMode=0
    aimL=0
    aimR=1
    aimC=0
    customkey=Not Set
    mute=0
    [img]
    profile=default
    loops=4
    reduc=2
    timeout=1
    abs=10
    Red1t=50
    Red2t=45
    Red3t=40
    WhiteW=1
    WhiteH=5
    WhiteT=25
    GreyW=1
    GreyH=5
    GreyT=30
    [trg]
    tX1=20
    tX2=20
    tY1=10
    tY2=30
    tFreq=125
    [hotkeys]
    1=F3
    2=F4
    3=F5
    4=F6
    5=F7
    [etc]
    showonce=0
    [settings]
    prevname=
    
    ), settings.ini
    } else {	
    	fileread,settings,settings.ini										; load ini file
    	stringsplit,settings,settings,`n									
    	iniread,PrevName,settings.ini,settings,prevname						; check previous name
    }
    SetWorkingDir, %A_ScriptDir%								
    if FileExist(A_ScriptDir "\" PrevName ".ahk") {							; if there is a file called (previous name)
    	Msgbox, Self-destruct failed on last exit. Attempting to delete %PrevName%.ahk...
    	FileDelete, %PrevName%.ahk											; delete it
    	Sleep, 250
    	if FileExist(A_ScriptDir "\" PrevName ".ahk") {
    		Msgbox, File may still be in use. Please kill %PrevName%.ahk in task manager.
    	}
    }
    
    ; ------------ generate random strings and run unique loader
    
    Random, ranNumber, 5, 10												; pick a random length for our string
    Loop %ranNumber% {														; loop:
    	Random, Var,97,122													; choose a random letter
    	ranString.=Chr(Var)													; store letter into string
    }
    FileCopy test.ahk,%ranString%.ahk											; make a copy of test.ahk, call it our random string
    SetWorkingDir, %A_ScriptDir%\res
    iniwrite,%ranString%,settings.ini,settings,prevname						; store name as prevname
    
    SetWorkingDir, %A_ScriptDir%
    Random, ranNumber, 50, 250												; pick a random length for our string
    Loop %ranNumber% {														; loop:
    	Random, Var,97,122													; choose a random letter
    	ranString2.=Chr(Var)												; store letter into string
    }
    FileAppend, %ranString2%, %ranString%.ahk								; append second string to end of new file
    Sleep, 200
    Run %ranString%.ahk														; run new ahk
    ExitApp
    The next step is to put this line of code between exit app and exit in the original script: (this is the self destruct mechanism)

    Use CTRL+F in notepad to find "ExitApp".

    Code:
    Run %comspec% /c ping -n 2 127.0.0.1>nul & Del "%A_ScriptFullPath%",, hide
    It should look like this in the original .ahk:
    Code:
    MainGuiEscape:
    MainGuiClose:
    Exit:
    Run %comspec% /c ping -n 2 127.0.0.1>nul & Del "%A_ScriptFullPath%",, hide
    ExitApp
    return
    Image 1(Before launch)

    Image 2 (After launch)


    NOW MAKE SURE TO NEVER LAUNCH THE ORIGINAL .AHK FILE AS IT WILL DELETE ITSELF WHEN CLOSED. ONLY LAUNCH THE NEW .AHK FILE


    P.S I apologize if my explanation is bad. I didn't have time to make a proper step-by-step guide.
    Last edited by Nukez15; 10-21-2018 at 09:42 AM. Reason: grammar

  13. The Following 5 Users Say Thank You to Nukez15 For This Useful Post:

    elflin1024 (10-21-2018),junomech (10-22-2018),Masbka (10-21-2018),mwkaka (10-22-2018),VampireGamerX (10-22-2018)

  14. #12
    bigalsbeepers's Avatar
    Join Date
    Oct 2018
    Gender
    male
    Posts
    1
    Reputation
    10
    Thanks
    0
    what should I adjust my screen width to if im on an ultrawide (2560x1080)?

  15. #13
    Masbka's Avatar
    Join Date
    Feb 2015
    Gender
    male
    Location
    Mother Russia
    Posts
    44
    Reputation
    10
    Thanks
    15
    My Mood
    Drunk
    @Nukez15, Thank you for your work. I did everything right?
    For me, it's better by hand and it all depends on fantasy, but the most private build is received.

  16. #14
    fatdoobie's Avatar
    Join Date
    Jul 2018
    Gender
    male
    Posts
    159
    Reputation
    10
    Thanks
    511
    Good job nukes, I was too lazy to write that for my script lol.

    I’m not sure if that will actually work with the ahk file though, AHK removes commented lines at runtime, and the last line of my script is a comment.

    When i get home I can write a slightly modified version of that which should actually have an effect on the hash.

    Theres also a line you can add to prevent self-destructing tge original.

  17. #15
    ricardmark1's Avatar
    Join Date
    Jul 2018
    Gender
    male
    Posts
    132
    Reputation
    10
    Thanks
    9
    Quote Originally Posted by fatdoobie View Post
    Good job nukes, I was too lazy to write that for my script lol.

    I’m not sure if that will actually work with the ahk file though, AHK removes commented lines at runtime, and the last line of my script is a comment.

    When i get home I can write a slightly modified version of that which should actually have an effect on the hash.

    Theres also a line you can add to prevent self-destructing tge original.
    That would be a verry good addition

Page 1 of 10 123 ... LastLast

Similar Threads

  1. [Help] [AHK] CS:GO| Balto Source Code. BHOP-TRIGGER-AIM (PROBABLY)
    By scruzz in forum Counter-Strike 2 Scripts
    Replies: 6
    Last Post: 07-16-2017, 11:52 PM
  2. [Source Code] found a source code with silent aim etc...
    By ImSoNerD in forum Call of Duty 4 - Modern Warfare (MW) Hacks
    Replies: 4
    Last Post: 08-15-2015, 06:50 AM
  3. [Source Code] - [Modified Auto Aim]
    By CrazyJani in forum Realm of the Mad God Tutorials & Source Code
    Replies: 2
    Last Post: 10-25-2013, 05:45 PM
  4. [Patched] dBased Auto Aim C++ source code from Mat Automaton.
    By samnang18 in forum Mission Against Terror Hacks & Cheats
    Replies: 21
    Last Post: 08-04-2013, 10:14 AM
  5. HALO 2 (XBOX) Source Code
    By mirelesmichael in forum General Game Hacking
    Replies: 12
    Last Post: 09-23-2006, 04:35 AM