[Path of Exile] Auto Potion
Posted: 23 Feb 2017, 22:18
Hi I'm new here. I'm not completely new to coding but have limited experience with it. I coded this auto potion myself. It is crude but has worked but it doesn't work always and I'm trying to understand why. If anyone can help with this I would appreciate it. There are other improvements that I want to make as well but these are secondary goals.
I get the address values for current hp (chp) and maximum hp (mhp) using Cheat Engine (CE) once at the start of each session. (i would really like an auto updating solution to this perhaps even without using CE if anyone has tips)
Buttons 1,2,3 are hp potions while 4,5,e are other helpful potions and e is a helpful skill. What I'm doing is cycling which potion gets used. So instead of completely depleting potion 1 and then going to potion 2 etc I'm using 1 charge of each potion. This is more efficient if you know the game the potions recharge after monsters are killed so it is smarter to use one of each that way when you kill monsters you gain more charges back then the aforementioned usage scenario.
Here is the actual auto potion:
I use this ReadMemory function made by another AHK user placed in the lib folder (C:\Program Files\AutoHotkey\lib):
Much Love,
Lemon
I get the address values for current hp (chp) and maximum hp (mhp) using Cheat Engine (CE) once at the start of each session. (i would really like an auto updating solution to this perhaps even without using CE if anyone has tips)
Buttons 1,2,3 are hp potions while 4,5,e are other helpful potions and e is a helpful skill. What I'm doing is cycling which potion gets used. So instead of completely depleting potion 1 and then going to potion 2 etc I'm using 1 charge of each potion. This is more efficient if you know the game the potions recharge after monsters are killed so it is smarter to use one of each that way when you kill monsters you gain more charges back then the aforementioned usage scenario.
Here is the actual auto potion:
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
^!p::Pause
SendMode Play
SetKeyDelay, 150, 150, Play
counter:=0
pot:=0
^j::
loop
{
chp:=ReadMemory(0x82B352A0)
mhp:=ReadMemory(0x82B352A4)
if (mhp-chp>1200)
{
if (Mod(counter, 3)=0)
{
Send, {1 1}
Send, {4 1}
Send, {5 1}
Send, {e 1}
Sleep, 200
}
if (Mod(counter, 3)=1)
{
Send, {2 1}
Send, {4 1}
Send, {5 1}
Send, {e 1}
Sleep, 200
}
if (Mod(counter, 3)=2)
{
Send, {3 1}
Send, {4 1}
Send, {5 1}
Send, {e 1}
Sleep, 200
}
}
counter+=1
}
Return
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
ReadMemory(MADDRESS)
{
winget, pid, PID, Path of Exile
VarSetCapacity(MVALUE,4,0)
ProcessHandle := DllCall("OpenProcess", "Int", 24, "Char", 0, "UInt", pid, "UInt")
DllCall("ReadProcessMemory","UInt",ProcessHandle,"UInt",MADDRESS,"Str",MVALUE,"UInt",4,"UInt *",0)
Loop 4
result += *(&MVALUE + A_Index-1) << 8*(A_Index-1)
return, result
}
Lemon