Code:
#NoEnv
#Persistent
#SingleInstance, Force
#KeyHistory, 0
#InstallKeybdHook
#UseHook
#HotKeyInterval 1
#MaxHotkeysPerInterval 127
SetBatchLines,-1
SetKeyDelay,-1, 8
SetControlDelay, -1
SetMouseDelay, 0
SetWinDelay,-1
ListLines, Off
SendMode, Input
CoordMode, Mouse, client
Numpad1::
Keywait, Numpad1, U
fileread,settings,settings.ini
stringsplit,settings,settings,`n
iniread,rx,settings.ini,settings,sen
iniread,xrange,settings.ini,settings,FovX
iniread,yrange,settings.ini,settings,FovY
iniread,xa,settings.ini,settings,AimX
iniread,xy,settings.ini,settings,AimY
iniread,tolerancered,settings.ini,settings,tolRed
iniread,tolerancewhite,settings.ini,settings,tolWhite
DirX := 0
DirY := 0
ZeroX := A_Screenwidth/2
ZeroY := A_Screenheight/2
X1 := 0 + (A_Screenwidth * (xrange / 10))
Y1 := 0 + (A_Screenheight * (yrange / 10))
X2 := A_Screenwidth - (A_Screenwidth * (xrange / 10))
Y2 := A_Screenheight - (A_Screenheight * (yrange / 10))
foundSmall := false
foundMedium := false
tolRed2 := tolerancered - 10
tolRed3 := tolerancered - 20
Soundbeep, 750, 500
loop, {
if (GetKeyState("RButton", "P") || GetKeyState("LButton", "P")) {
GoSub MouseMoves2
continue
}
if GetKeyState("Numpad1", "P") {
Keywait, Numpad1, U
break
}
Sleep, 1
}
Soundbeep, 500, 250
return
MouseMoves2:
if (!foundMedium && !foundSmall) {
imagesearch, AimPixelX, AimPixelY, %X1%, %Y1%, %X2%, %Y2%, *%tolerancered% healthbar.bmp ; big red bar
if (AimPixelX != "" && AimPixelY != "") {
GoSub, getnewoffsets
imagesearch, newX, newY, %newX1%, %newY1%, %newX2%, %newY2%, *%tolerancewhite% secondimage.bmp ; secondary reference point
if (newX != "" && newY != "") {
gosub, GetAimOffset1
gosub, GetAimMoves1
return
}
}
}
if (!foundSmall) {
imagesearch, AimPixelX, AimPixelY, %X1%, %Y1%, %X2%, %Y2%, *%tolRed2% healthbar2.bmp ; medium red bar
if (AimPixelX != "" && AimPixelY != "") {
GoSub, getnewoffsets
imagesearch, newX, newY, %newX1%, %newY1%, %newX2%, %newY2%, *%tolerancewhite% secondimage.bmp ; secondary reference point
if (newX != "" && newY != "") {
foundMedium := true
gosub, GetAimOffset1
gosub, GetAimMoves1
return
}
}
}
foundMedium := false
imagesearch, AimPixelX, AimPixelY, %X1%, %Y1%, %X2%, %Y2%, *%tolRed3% healthbar3.bmp ; small red bar
if (AimPixelX != "" && AimPixelY != "") {
GoSub, getnewoffsets
imagesearch, newX, newY, %newX1%, %newY1%, %newX2%, %newY2%, *%tolerancewhite% secondimage.bmp ; secondary reference point
if (newX != "" && newY != "") {
foundSmall := true
gosub, GetAimOffset1
gosub, GetAimMoves1
return
}
}
foundSmall := false
return
GetAimOffset1:
AimX := AimPixelX - ZeroX +xa
AimY := AimPixelY - ZeroY +xy
if (AimX > 10) {
DirX := rx / 10
} else if (AimX > 0) {
DirX := rx / 15
}
if (AimX < -10) {
DirX := (-rx) / 10
} else if (AimX < 0) {
DirX := (-rx) / 15
}
if (AimY > 0) {
DirY := rx /13
} else if (AimY < 0) {
DirY := (-rx) /13
}
AimOffsetX := AimX * DirX
AimOffsetY := AimY * DirY
Return
GetAimMoves1:
RootX := Ceil(( AimOffsetX ** ( 1 )))
RootY := Ceil(( AimOffsetY ** ( 1 )))
MoveX := RootX * DirX
MoveY := RootY * DirY
DllCall("mouse_event", uint, 1, int, MoveX, int, MoveY, uint, 0, int, 0)
Return
getnewoffsets:
newX1 := AimPixelX - 50
newX2 := AimPixelX - 10
newY1 := AimPixelY - 30
newY2 := AimPixelY + 10
return