RHCP shows how to use it in his example.LemonHaze_ wrote:But now how do I use this getProcessBaseAddress functions you posted for the sake of learning?
I don't understand why your code works without it unless perhaps PoE's base address is always 0.
RHCP shows how to use it in his example.LemonHaze_ wrote:But now how do I use this getProcessBaseAddress functions you posted for the sake of learning?
You don't need to use it in your situation.LemonHaze_ wrote:I figured out a new working set of static address and offsets (well only the static address changed the offsets are still the same). My program works fine with the new values. But now how do I use this getProcessBaseAddress functions you posted for the sake of learning?
I use it to get a base address value. Now assuming this is a static address how do i find the offsets from this base that lead to current hp and max hp? And so if the function always finds the base address and if the offsets from that base address to my desired variable never change then this is a more update/patch proof solution is that right?
What is the idea behind the way you are formating your sends? When I test this in Notepad it sends "e". So it seems to be identical to "Send, e".Send, {e 1}
Use sleep between sends for control.LemonHaze_ wrote:I'm just trying to slow down the program.
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.
#Include <classMemory>
; You can use this code to check if you have installed the class correctly.
if (_ClassMemory.__Class != "_ClassMemory")
{
msgbox class memory not correctly installed. Or the (global class) variable "_ClassMemory" has been overwritten
ExitApp
}
poe := new _ClassMemory("ahk_exe PathOfExile_x64Steam.exe", "", hProcessCopy)
; Check if the above method was successful.
if !isObject(poe)
{
msgbox failed to open a handle
if (hProcessCopy = 0)
msgbox The program isn't running (not found) or you passed an incorrect program identifier parameter.
else if (hProcessCopy = "")
msgbox OpenProcess failed. If the target process has admin rights, then the script also needs to be ran as admin. Consult A_LastError for more information.
ExitApp
}
base:=getProcessBaseAddress("ahk_exe PathOfExile_x64Steam.exe")
s1:=base+0x1311268
p1:=poe.Read(s1)
p2:=poe.Read(p1+0xa10)
p3:=poe.Read(p2, "UInt", 0x998)
chp:=poe.Read(p3, "UInt", 0x9d8)
mhp:=poe.Read(p3, "UInt", 0x9d0)
WinGet, pid, PID, ahk_exe PathOfExile_x64Steam.exe
MsgBox, The POE's PID is %pid%`nbase = %base%`ns1 = %s1%`np1 = %p1%`np2 = %p2%`np3 = %p3%`nchp = %chp%`nmhp = %mhp%
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(address)
{
; It would be safer to use a more exact title for winget e.g.
; winget, pid, PID, ahk_exe PathOfExile.exe ; or what ever the exe is called
; otherwise you risk reading from another process when PoE isn't the active window.
WinGet, pid, PID, ahk_exe PathOfExile_x64Steam.exe
if !pid
return
if !hProcess := DllCall("OpenProcess", "UInt", 24, "Int", False, "UInt", pid, "Ptr")
return
success := DllCall("ReadProcessMemory", "Ptr", hProcess, "Ptr", address, "UInt*", result, "Ptr", 4, "Ptr",0)
DllCall("CloseHandle", "Ptr", hProcess)
return success ? result : ""
}
Code: Select all
f1::
if (A_ptrSize != 8)
{
msgbox "AHK needs to run as 64 bit!"
ExitApp
}
if (_classmemory.version() < 2.8)
{
msgbox update class memory ; https://github.com/Kalamity/classMemory
exitapp
}
poe := new _classmemory("ahk_exe PathOfExile_x64Steam.exe")
hp := poe.read(poe.baseaddress + 0x1311268, "UInt", 0xa10, 0x998, 0x9d8)
maxHP := poe.read(poe.baseaddress + 0x1311268, "UInt", 0xa10, 0x998, 0x9d0)
msgbox % hp "`n" maxHP
return
If you have multiple classMemory.ahk files spread among those folders and use "#Include <classMemory>" syntax (which searches the library folders for the file) then that could cause an issue.%A_ScriptDir%\Lib\ ; Local library - requires AHK_L 42+.
%A_MyDocuments%\AutoHotkey\Lib\ ; User library.
path-to-the-currently-running-AutoHotkey.exe\Lib\ ; Standard library.
if a script calls a nonexistent function MyFunc(), the program searches for a file named "MyFunc.ahk" in the user library. If not found there, it searches for it in the standard library.
[AHK_L 42+]: The local library is supported and is searched before the user library and standard library.
Code: Select all
msgbox % _classmemory.version()
Code: Select all
#Include <classMemory>
Code: Select all
; You can use this code to check if you have installed the class correctly.
if (_ClassMemory.__Class != "_ClassMemory")
{
msgbox class memory not correctly installed. Or the (global class) variable "_ClassMemory" has been overwritten
ExitApp
}
Works on my computer also.RHCP wrote:Make sure classMemory.ahk is up-to-date (version 2.8). You need to launch the script via the 64 bit AHK exe i.e. run the script as 64 bits to allow 8 byte pointers to work.
This works on my computer.Code: Select all
f1:: if (A_ptrSize != 8) { msgbox "AHK needs to run as 64 bit!" ExitApp } if (_classmemory.version() < 2.8) { msgbox update class memory ; https://github.com/Kalamity/classMemory exitapp } poe := new _classmemory("ahk_exe PathOfExile_x64Steam.exe") hp := poe.read(poe.baseaddress + 0x1311268, "UInt", 0xa10, 0x998, 0x9d8) maxHP := poe.read(poe.baseaddress + 0x1311268, "UInt", 0xa10, 0x998, 0x9d0) msgbox % hp "`n" maxHP return
Well it was working up till the latest update.FanaticGuru wrote:Works on my computer also.
Code: Select all
hp := poe.read(poe.baseaddress + 0x1311268, "UInt", 0xa10, 0x998, 0x9d8)
maxHP := poe.read(poe.baseaddress + 0x1311268, "UInt", 0xa10, 0x998, 0x9d0)
Users browsing this forum: No registered users and 74 guests