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
; INI Files / GUI setup
INI_Init("settings.ini")
GoSub, trimImg
GoSub, trimMain
GoSub, LoadGUI
GoSub, ShowGUI
GoSub, UpdateMainGuiText
; 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 * 80 / 1920) ; mid red W
g_rh2 := Floor(g_H * 8 / 1080) ; mid red H
g_rw3 := Floor(g_W * 35 / 1920) ; min red W
g_rh3 := Floor(g_H * 9 / 1080) ; max red H
do_recoil := 0
GoSub, g_scan
GoSub, img_statics
; 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
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
}
; -------------------- End auto-execute --------------------
^!F12::
AutoAdjust:
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 := 1
Gui Main:Default
Gui, submit, nohide
GoSub, UpdateMainGuiText
if (main_mute = 0) {
loop, 2 {
Soundbeep, 900, 100
}
}
loop, {
if ((GetKeyState("LButton","P")) && (main_anti = 1)) {
GoSub, mouseXY
}
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
}
gosub, check_recoil
if (ai = 1) {
gosub, g_scan
}
if (GetKeyState(hotkeys_1, "P")) {
Keywait, %hotkeys_1%, U
break
}
Sleep, 1
}
b := 0
Gosub, UpdateMainGuiText
if (main_mute = 0) {
Soundbeep, 900, 100
}
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 * 150 / 1920)
X2 := aX + g_rw1 + (g_W * 100 / 1920)
Y1 := aY - (g_H * 90 / 1080)
Y2 := aY + g_rh2 + (g_H * 90 / 1080)
return
ai_timeout: ; force unlock
lockOn := ""
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 && main_PVMode != 4) {
GoSub, scan2
if (ErrorLevel = 0) {
lockOn := i
retry := 0
GoSub, ai_scan
GoSub, mouse1
return
}
} else if (ErrorLevel = 0 && main_PVMode = 4) {
lockOn := i
GoSub, mouse1
return
}
}
return
lockTarget: ; lock on scan
imagesearch, aX, aY, %X1%, %Y1%, %X2%, %Y2%, *%v1% *w%v2% *h%v3% bmp\1.bmp
if (ErrorLevel = 0 && main_PVMode != 4) {
GoSub, scan2
if (ErrorLevel = 0) {
SetTimer, ai_timeout, -%t%
GoSub, ai_scan
GoSub, mouse1
retry := 0
return
}
} else if (ErrorLevel = 0 && main_PVMode = 4) {
lockOn := i
GoSub, mouse1
return
}
if (lockOn = "1") {
if (v2 > g_minv) {
v2 := Abs(v2 * (100 - (img_reduc / 2)) / 100) ; less aggressive width reduc for shielded bars
}
if (v2 <= g_rw3) { ; force unshielded search if we reach low hp
v3 := g_rh3
retry++ ; add one less retry for good measure... ;)
}
} else {
if (v2 > g_minv) {
v2 := Abs(v2 * (100 - img_reduc) / 100)
}
}
if (retry < img_loops) {
retry ++
if (lockOn = "1" && retry > Floor(img_loops / 2)) { ; less aggressive retry for shielded bars
retry := 0
lockOn := ""
}
} else {
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 - Ceil(g_W * 37 / 1920) - 5
newX2 := aX - Ceil(g_W * 8 / 1920) + 5
newY1 := aY - Ceil(g_H * 19 / 1080) - 4
newY2 := aY + Ceil(g_H * 10 / 1080) + 4
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 - Ceil(g_W * 3 / 1920)
newX2 := aX + Ceil(g_W * 60 / 1920)
newY1 := aY - Ceil(g_H * 20 / 1080) - 5
newY2 := aY - Ceil(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 ; set search result locations to fixed offsets relative to centre of screen
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) { ; triggerbot zone check
doingClick := 1
SetTimer, mouse2, -25 ; 0.025 second delay on trigger call
}
}
if (AimX > main_shake) { ; if target is outside shake zone to the left...
DirX := main_sen / 10
} else if (AimX > 0) { ; inside shake zone...
DirX := main_sen / 15
} else if (AimX < -main_shake) { ; outside to the right...
DirX := (-main_sen) / 10
} else if (AimX < 0) { ; inside
DirX := (-main_sen) / 15
}
if (AimY > 0) { ; target Y is below
DirY := main_sen / 12
} else if (AimY < 0) { ; above
DirY := (-main_sen) / 12
}
MoveX := Ceil(( AimX * DirX ** ( 1 ))) * DirX ; relative speed based on distance. DirX/Y is called twice to retain +/- direction.
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 ELEMENT FUNCTIONS ------
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
}
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
}
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
}
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 -DPIscale
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.0
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, -DPIScale
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, -DPIScale
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, -DPIScale
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