Skip to content

Instantly share code, notes, and snippets.

@Insektosaurus
Last active August 29, 2021 17:21
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save Insektosaurus/cb9f6b28cc255223c4a03e275befe1e9 to your computer and use it in GitHub Desktop.
Save Insektosaurus/cb9f6b28cc255223c4a03e275befe1e9 to your computer and use it in GitHub Desktop.
Automatically detonate mines in Path Of Exile (PoE) . With multiple modes.

How to use

First make sure that you have Autohotkey installed on your system, if now you can Get Autohotkey here](https://www.autohotkey.com/download/).

After downloading and installing you can get the script to run by:

  • Create a new file for example on your desktop, call the file "PoE_AutoDetonateMines.ahk" or something else but ensure it has the .ahk extension. Alternatively you can also just download this giist as a zip file and extract the script (.ahk file)

  • Paste the content of the gist into the file.

  • Close the file, right click on it and select Compile Script, this will compile the script into an executable you can (re-) use to run the script in the background.

  • Double-Click on the newly created file ( PoE_AutoDetonateMines.exe )

  • Launch PoE and see if everything works.

Script Modes & Settings

If you want to change the settings on the script then open the .ahk file with the text-editor of your choice and see the section market with SET PREFERENCES HERE. See the comments there.

Mode 0

This mode will pause the script. When paused, the script will not do anything and ignore all hotkeys.

This mode can be used for pre-laying mines on bosses if you don't want to auto-detonate them. Once the fight starts and the mines exploded, you can swap to another mode using F5.

Mode 1

In this mode, the script will listen for an RButton UP event. If for example, the variable delayBeforeMinesExplodeInMs_State1 is set to '2000' then the script will detonate all existing mines (using the d button) after 2000 milliseconds (2 seconds), AFTER the user has RELEASED the right mouse button.

Mode 2

Does the same as mode one, but you can specify another time interval here. For example, 500 which will - just as mode one - detonate all placed mines after 500 ms after releasing the right mouse button.

Mode 3

Probably the most used mode? In this mode, as long as you hold down right-click, mines will be detonated as well. Run and Gun style.

This script will automatically detonate mines for you. Press F5 to pause the script or change between modes (auto-detonate with delay, instantly detonate etc.)

#NoEnv
#Warn
#InstallKeybdHook
#InstallMouseHook
#Persistent
#useHook, On
#SingleInstance force
SetBatchLines, -1
SendMode Input
SetWorkingDir %A_ScriptDir%
#IfWinActive, ahk_class POEWindowClass ; Ensures the script runs only if the focused window is PoE
; ------------------------------------------ SET PREFERENCES HERE -----------------------------------------------------------------------------------------------
splashMessageDelay = 2000 ; Time in millisconds how long the message box is shown between pausing / resuming.
delayBeforeMinesExplodeInMs_State1 = 2000 ; 500 means that the script will wait 1000ms before detonating the mines.
delayBeforeMinesExplodeInMs_State2 = 50 ; 50 means that the script will wait 50ms before detonating the mines (basically instant on release).
; (exactly 1 second) milliseconds to detonate the mines.
; Change this to 250, 250 for example to detonate them 4 times per second.
state = 0 ; State in which the script starts. 0 = The script is paused, 1 = it is running in state 1, 2 = running in state 2..
; ------------------------------------------ SET PREFERENCES HERE -----------------------------------------------------------------------------------------------
; If you don't want to see the messagebox at start you can comment it out by placing a ';' at the start of the line
MsgBox, Started script. `nState: Paused. `nMode1: Delay between explosions: %delayBeforeMinesExplodeInMs_State1%ms. `nMode2: Delay between explosions: %delayBeforeMinesExplodeInMs_State2%ms. `nDelay between infobox toggle: %splashMessageDelay%ms.
F5:: ; Pressing F5 will pause the script if you want to layer in some mines.
; Change F5 to any other hotkey if you want.
{
if (%state% = 0)
{
%state% = 1
SplashTextOn,,, % "Changed => State 1. Delay: " . delayBeforeMinesExplodeInMs_State1 . "."
sleep %splashMessageDelay%
SplashTextOff
}
else if (%state% = 1)
{
%state% = 2
SplashTextOn,,, % "Changed => State 2. Delay: " . delayBeforeMinesExplodeInMs_State2 . "."
sleep %splashMessageDelay%
SplashTextOff
}
else if (%state% = 2)
{
%state% = 3
SplashTextOn,,, % "Changed => State 3. While RMB Down."
sleep %splashMessageDelay%
SplashTextOff
}
else if (%state% = 3)
{
%state% = 0
SplashTextOn,,, % "Changed => State 0. PAUSED!"
sleep %splashMessageDelay%
SplashTextOff
}
else
{
; Open for extensions.
}
return
}
~RButton Up::
{
if (%state% = 1) {
sleep, %delayBeforeMinesExplodeInMs_State1%
send d
return
}
if (%state% = 2) {
sleep, %delayBeforeMinesExplodeInMs_State2%
send d
return
}
return
}
~RButton::
{
if (%state% = 3) {
while GetKeyState("RButton", "P")
{
send d
sleep 50
}
return
}
}
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment