Brainfart
Posted: 08 Mar 2018, 00:10
So you guys are probably going to notice what this is right when you see it. However, I'm trying to add functionality to this so I can improve on it's original design. I've never used AHK before this but this has made me pretty interested on how it works. I have an intermediate understanding of programming so i'm not totally stupid, however i've been staring at this and drawing a blank.
So basically this is an aimbot. However the original creator left out the yellow health bar enemies. I'm trying to write that in using my own bitmap image but i'm getting lost. I've tried inserting an else if condition, and i really am stumped here. Any suggestions?
Something i've tried is to the effect of:
Code: Select all
; <COMPILER: v1.1.24.01>
#SingleInstance, Force
#Persistent
#NoEnv
#Warn
SendMode, Input
SetWorkingDir, %A_ScriptDir%
DirX := 0
DirY := 0
Numpad1::
#Persistent
#KeyHistory, 0
#NoEnv
#HotKeyInterval 1
#MaxHotkeysPerInterval 127
#InstallKeybdHook
#UseHook
#SingleInstance, Force
SetKeyDelay,-1, 8
SetControlDelay, -1
SetMouseDelay, 0
SetWinDelay,-1
SendMode, InputThenPlay
SetBatchLines,-1
ListLines, Off
CoordMode, Mouse, client
PID := DllCall("GetCurrentProcessId")
Process, Priority, %PID%, Normal
ZeroX := A_Screenwidth/2
ZeroY := A_Screenheight/2
CFovX := 80
CFovY := 200
ScanL := 660
ScanR := 1250
ScanT := 280
ScanB := 610
inicount := 9
fileread,settings,settings.ini
stringsplit,settings,settings,`n
if !(fileexist("settings.ini")) || (settings0-3 != inicount)
{
iniread,rx,settings.ini,settings,sen, 3.2
iniread,xrange,settings.ini,settings,FovX, 4.5
iniread,yrange,settings.ini,settings,FovY, 3.5
iniread,xa,settings.ini,settings,AimX, 85
iniread,xy,settings.ini,settings,AimY, 49
}
Soundbeep, 750, 500
Loop,
{
GetKeyState, Mouse2, LButton, P
GetKeyState, Mouse3, RButton, P
if ( Mouse2 == "D" ) || ( Mouse3 == "D" )
{
GoSub MouseMoves2
}
GetKeyState, Key1, Numpad1, P
if ( Key1 == "D")
{
Soundbeep
break
}
}
MouseMoves2:
imageSearch, AimPixelX, AimPixelY, 0 + (A_Screenwidth * (xrange/10)), 0 + (A_Screenheight * (yrange/10)), A_Screenwidth - (A_Screenwidth * (xrange/10)), A_Screenheight - (A_Screenheight * (yrange / 10)), healthbar.bmp
if(AimPixelX != "" && AimPixelY != "")
{
GoSub GetAimOffset1
GoSub GetAimMoves1
}
else
{
imageSearch, AimPixelX, AimPixelY, 0 + (A_Screenwidth * (xrange/10)), 0 + (A_Screenheight * (yrange/10)), A_Screenwidth - (A_Screenwidth * (xrange/10)), A_Screenheight - (A_Screenheight * (yrange / 10)), *4 orangehealthbar.bmp
if(AimPixelX != "" && AimPixelY != "")
{
GoSub GetAimOffset1
GoSub GetAimMoves1
}
}
Return
GetAimOffset1:
Gui,Submit, Nohide
AimX := AimPixelX - ZeroX +xa
AimY := AimPixelY - ZeroY +xy
if ( AimX+10 > 0)
{
DirX := rx / 10
}
else if ( AimX+5 > 0)
{
DirX := rx / 15
}
if ( AimX+10 < 0)
{
DirX := (-rx) / 10
}
else if ( AimX+5 < 0)
{
DirX := (-rx) / 15
}
if ( AimY+.25 > 0 )
{
DirY := rx /13
}
if ( AimY+.25 < 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
Something i've tried is to the effect of:
Code: Select all
; <COMPILER: v1.1.24.01>
#SingleInstance, Force
#Persistent
#NoEnv
#Warn
SendMode, Input
SetWorkingDir, %A_ScriptDir%
DirX := 0
DirY := 0
Numpad1::
#Persistent
#KeyHistory, 0
#NoEnv
#HotKeyInterval 1
#MaxHotkeysPerInterval 127
#InstallKeybdHook
#UseHook
#SingleInstance, Force
SetKeyDelay,-1, 8
SetControlDelay, -1
SetMouseDelay, 0
SetWinDelay,-1
SendMode, InputThenPlay
SetBatchLines,-1
ListLines, Off
CoordMode, Mouse, client
PID := DllCall("GetCurrentProcessId")
Process, Priority, %PID%, Normal
ZeroX := A_Screenwidth/2
ZeroY := A_Screenheight/2
CFovX := 80
CFovY := 200
ScanL := 660
ScanR := 1250
ScanT := 280
ScanB := 610
inicount := 9
fileread,settings,settings.ini
stringsplit,settings,settings,`n
if !(fileexist("settings.ini")) || (settings0-3 != inicount)
{
iniread,rx,settings.ini,settings,sen, 3.2
iniread,xrange,settings.ini,settings,FovX, 4.5
iniread,yrange,settings.ini,settings,FovY, 3.5
iniread,xa,settings.ini,settings,AimX, 85
iniread,xy,settings.ini,settings,AimY, 49
}
Soundbeep, 750, 500
Loop,
{
GetKeyState, Mouse2, LButton, P
GetKeyState, Mouse3, RButton, P
if ( Mouse2 == "D" ) || ( Mouse3 == "D" )
{
GoSub MouseMoves2
}
GetKeyState, Key1, Numpad1, P
if ( Key1 == "D")
{
Soundbeep
break
}
}
MouseMoves2:
imageSearch, AimPixelX, AimPixelY, 0 + (A_Screenwidth * (xrange/10)), 0 + (A_Screenheight * (yrange/10)), A_Screenwidth - (A_Screenwidth * (xrange/10)), A_Screenheight - (A_Screenheight * (yrange / 10)), healthbar.bmp
if(AimPixelX != "" && AimPixelY != "")
{
GoSub GetAimOffset1
GoSub GetAimMoves1
}
else
{
imageSearch, AimPixelX, AimPixelY, 0 + (A_Screenwidth * (xrange/10)), 0 + (A_Screenheight * (yrange/10)), A_Screenwidth - (A_Screenwidth * (xrange/10)), A_Screenheight - (A_Screenheight * (yrange / 10)), *4 orangehealthbar.bmp
if(AimPixelX != "" && AimPixelY != "")
{
GoSub GetAimOffset1
GoSub GetAimMoves1
}
else
{
imageSearch, AimPixelX, AimPixelY, 0 + (A_Screenwidth * (xrange/10)), 0 + (A_Screenheight * (yrange/10)), A_Screenwidth - (A_Screenwidth * (xrange/10)), A_Screenheight - (A_Screenheight * (yrange / 10)), *4 yellowhealthbar.bmp
if(AimPixelX != "" && AimPixelY != "")
{
GoSub GetAimOffset1
GoSub GetAimMoves1
}
}
}
Return
GetAimOffset1:
Gui,Submit, Nohide
AimX := AimPixelX - ZeroX +xa
AimY := AimPixelY - ZeroY +xy
if ( AimX+10 > 0)
{
DirX := rx / 10
}
else if ( AimX+5 > 0)
{
DirX := rx / 15
}
if ( AimX+10 < 0)
{
DirX := (-rx) / 10
}
else if ( AimX+5 < 0)
{
DirX := (-rx) / 15
}
if ( AimY+.25 > 0 )
{
DirY := rx /13
}
if ( AimY+.25 < 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