1. Copy the script
2. Create a text file anywhere, open it in a text editor
3. Paste the copied code in
4. Save the file as
5. Run the script
Code:
#NoEnv
#SingleInstance, Force
#Persistent
#MaxThreadsPerHotkey, 10
#InstallKeybdHook
#KeyHistory, 0
#UseHook
Process, Priority,, High
ListLines, Off
SetBatchLines, -1
SetWorkingDir %A_ScriptDir%
SetWinDelay, -1
SetMouseDelay, 0
SetKeyDelay, 1, 2
SendMode Input
OnExit DoBeforeExit
;GUI variables
recoil_offset := 8
counter_a := 0
counter_b := 0
recoil_status := "Disabled"
trigger_status := "Disabled"
if (FileExist("TD.txt"))
{
FileRead, readfile, TD.txt
if ((readfile < 100) AND (readfile > -100))
{
recoil_offset := readfile
}
else if (ErrorLevel)
{
recoil_offset := 8
}
}
else
{
recoil_offset := 8
}
Gui, +AlwaysOnTop +ToolWindow -Caption +Owner +LastFound +E0x20 ;E0x20 - Windows form style to allow click-through to what is below
Gui, Margin, 0, 0
Gui, Color, Grey
Gui, Font, cRed s30 bold q4, Arial
Gui, Add, Text, x13 y0 w280 h40, Recoil Reduce
Gui, Add, Text, x307 y0 w14 h50, |
Gui, Add, Text, x330 y0 w170 h40 vrecoil_status, %recoil_status%
Gui, Font, cWhite s30 bold q4, Arial
Gui, Add, Text, x510 y0 w80 h50 vrecoil_offset, s%recoil_offset%
Gui, Font, cRed s30 bold q4, Arial
Gui, Add, Text, x13 y50 w280 h50, Triggerbot
Gui, Add, Text, x307 y50 w14 h50, |
Gui, Add, Text, x330 y50 w170 h40 vtrigger_status, %trigger_status%
WinSet, Transparent, 200
Gui, Show, x0 y500 h100 w600 NoActivate
Hotkey, $*~LButton, Toggle ;Toggle hotkey off - starting state
#IfWinActive, ahk_exe TheDivision.exe
UP::
{
Hotkey, $*~LButton, Toggle
returned := toggler(counter_a, 1)
tex := returned[1]
col := returned[2]
GuiControl, +%col%, recoil_status ;set colour
GuiControl, , recoil_status, %tex% ;set text
counter_a += 1
}
return
NumpadSub::
{
if (recoil_offset > -99)
{
recoil_offset -= 1
GuiControl,, recoil_offset, s%recoil_offset%
}
}
return
NumpadAdd::
{
if (recoil_offset < 99)
{
recoil_offset += 1
GuiControl,, recoil_offset, s%recoil_offset%
}
}
return
5::
{
returned := toggler(counter_b, 2)
tex := returned[1]
col := returned[2]
GuiControl, +%col%, trigger_status ;set colour
GuiControl, , trigger_status, %tex% ;set text
counter_b += 1
}
return
$*~LButton:: ; Recoil-reduce
{
if (WinActive("ahk_exe TheDivision.exe"))
{
while GetKeyState("LButton")
{
DllCall("mouse_event", uint, 1, int, 0, int, recoil_offset, uint, 1, int, 0)
Sleep, 25
}
}
}
return
Trigger:
{
Loop
{
if (Mod(counter_b, 2) = 0)
{
return
}
if (WinActive("ahk_exe TheDivision.exe"))
{
if (GetKeyState("RButton", "P"))
{
Loop ; 934, 538, 987, 542
{ ; wider search:
PixelSearch, outx, outy, 934, 538, 987, 544, 0xF93236, 10, FastRGB
if (outx) ;match, crosshair is lit
{
DllCall("mouse_event", "UInt", 0x02) ; left mouse button down
Sleep, 1 ; enough time to register click in-game
DllCall("mouse_event", "UInt", 0x04) ; left mouse button up
}
Sleep, 2 ;delay to allow for RButton's un-pressing to register
if (GetKeyState("RButton", "T"))
{
break
}
}
}
else
{
Sleep, 100 ;No need to run key check so often
}
}
else
{
Sleep, 800 ;Enough for a tab-into the window and ESC to close the In-game GUI
}
}
}
return
toggler(counter, option)
{
if (Mod(counter, 2) = 0)
{
fstatus := "Enabled"
colour := "clime"
if (option = 2)
{
SetTimer, Trigger, -0
}
}
else
{
fstatus := "Disabled"
colour := "cred"
}
return [fstatus, colour]
}
DoBeforeExit:
{
FileDelete, TD.txt
FileAppend, %recoil_offset%, TD.txt
FileSetAttrib, +H, TD.txt
ExitApp
}