Jump to content

Join our Slack

Talk to other users and have a great time
Slack Server

Welcome to our Community

Click here to get your Exiled Bot license
Donation Store
SnowFlake

Path Of Exile reading pointers example [AHK]

Recommended Posts

Hello, this is an example of what you can do with AHK and pointers/reading the games memory, i hope someone finds this useful  :)
 
Main page:

http://www.autohotkey.com/board/topic/148284-path-of-exile-reading-pointers-example/
 
video:


 
Picture:
7daaf83ed7.png
 
links also posted on:
http://www.autohotke...inters-example/
http://www.mpgh.net/...4679&p=10802732
http://www.blizzhack...?f=245&t=502518
 
scripts/functions i used:
 
Poe.ahk
IF NOT A_IsAdmin
{
   Run *RunAs "%A_ScriptFullPath%"
   ExitApp
}

#Include, memory.ahk
#SingleInstance force

ProcessName := "PathOfExile.exe"

hwnd := MemoryOpenFromName(ProcessName)

HP = 
SH = 
MA = 
EX = 

IT = 
ST = 
DE = 

Gui, +AlwaysOnTop

Gui, Add, Text,,Life:
Gui, Add, Text,,Shield:
Gui, Add, Text,, Mana:
Gui, Add, Text,, EXP:

Gui, Add, Text,,Intelligence:
Gui, Add, Text,, Strenght:
Gui, Add, Text,, Dexterity:

Gui, Add, Edit, ReadOnly vHP_GUI ym
Gui, Add, Edit, ReadOnly vSH_GUI
Gui, Add, Edit, ReadOnly vMA_GUI
Gui, Add, Edit, ReadOnly vEX_GUI

Gui, Add, Edit, ReadOnly vIT_GUI
Gui, Add, Edit, ReadOnly vST_GUI
Gui, Add, Edit, ReadOnly vDE_GUI
Gui, Show, , POE Reader


Loop
{
   
 ; Life,Mana,sheiald,exp  
HP2 := MemoryReadPointer(hwnd,HP, "int")
GuiControl,, HP_GUI, %HP2%

SH2 := MemoryReadPointer(hwnd,SH, "int")
GuiControl,, SH_GUI, %SH2%

MA2 := MemoryReadPointer(hwnd,MA, "int")
GuiControl,, MA_GUI, %MA2%

EX2 := MemoryReadPointer(hwnd,EX, "int")
GuiControl,, EX_GUI, %EX2%

; inteletins,srange,dexter
IT2 := MemoryReadPointer(hwnd,IT, "int")
GuiControl,, IT_GUI, %IT2%

ST2 := MemoryReadPointer(hwnd,ST, "int")
GuiControl,, ST_GUI, %ST2%

DE2 := MemoryReadPointer(hwnd,DE, "int")
GuiControl,, DE_GUI, %DE2%
}
return

memory.ahk

MemoryOpenFromPID(PID, Privilege=0x1F0FFF)
{
	HWND := DllCall("OpenProcess", "Uint", Privilege, "int", 0, "int", PID)
	return HWND
}

MemoryOpenFromName(Name, Privilege=0x1F0FFF)
{
	Process, Exist, %Name%
	PID := ErrorLevel
	Return MemoryOpenFromPID(PID, Privilege)
}

MemoryOpenFromTitle(title, privilege=0x1F0FFF)
{
	WinGet, PID, PID, %title%
	Return MemoryOpenFromPID(PID, Privilege)
}

MemoryClose(hwnd)
{
	return DllCall("CloseHandle", "int", hwnd)
}

MemoryWrite(hwnd, address, writevalue, datatype="int", length=4, offset=0)
{
	VarSetCapacity(finalvalue, length, 0)
	NumPut(writevalue, finalvalue, 0, datatype)
	return DllCall("WriteProcessMemory", "Uint", hwnd, "Uint", address+offset, "Uint", &finalvalue, "Uint", length, "Uint", 0)
}

MemoryRead(hwnd, address, datatype="int", length=4, offset=0)
{
	VarSetCapacity(readvalue,length, 0)
	DllCall("ReadProcessMemory","Uint",hwnd,"Uint",address+offset,"Str",readvalue,"Uint",length,"Uint *",0)
	finalvalue := NumGet(readvalue,0,datatype)
	return finalvalue
}

MemoryWritePointer(hwnd, base, writevalue, datatype="int", length=4, offsets=0, offset_1=0, offset_2=0, offset_3=0, offset_4=0, offset_5=0, offset_6=0, offset_7=0, offset_8=0, offset_9=0)
{
	B_FormatInteger := A_FormatInteger 
	Loop, %offsets%
	{
		baseresult := MemoryRead(hwnd,base)
		Offset := Offset_%A_Index%
		SetFormat, integer, h
		base := baseresult + Offset
		SetFormat, integer, d
	}
	SetFormat, Integer, %B_FormatInteger%
	return MemoryWrite(hwnd,address,writevalue,datatype,length)
}

MemoryReadPointer(hwnd, base, datatype="int", length=4, offsets=0, offset_1=0, offset_2=0, offset_3=0, offset_4=0, offset_5=0, offset_6=0, offset_7=0, offset_8=0, offset_9=0)
{
	B_FormatInteger := A_FormatInteger 
	Loop, %offsets%
	{
		baseresult := MemoryRead(hwnd,base)
		Offset := Offset_%A_Index%
		SetFormat, integer, h
		base := baseresult + Offset
		SetFormat, integer, d
	}
	SetFormat, Integer, %B_FormatInteger%
	return MemoryRead(hwnd,base,datatyp,length)
}

MemoryGetAddrPID(PID, DllName)
{
    VarSetCapacity(me32, 548, 0)
    NumPut(548, me32)
    snapMod := DllCall("CreateToolhelp32Snapshot", "Uint", 0x00000008, "Uint", PID)
    If (snapMod = -1)
        Return 0
    If (DllCall("Module32First", "Uint", snapMod, "Uint", &me32))
	{
		Loop
       	{
            If (!DllCall("lstrcmpi", "Str", DllName, "UInt", &me32 + 32)) {
                DllCall("CloseHandle", "UInt", snapMod)
                Return NumGet(&me32 + 20)
            }
        }
		Until !DllCall("Module32Next", "Uint", snapMod, "UInt", &me32)
    }
    DllCall("CloseHandle", "Uint", snapMod)
    Return 0
}

MemoryGetAddrName(Name, DllName)
{
	Process, Exist, %Name%
	PID := ErrorLevel
	Return MemoryGetAddrPID(PID, DllName)
}

MemoryGetAddrTitle(Title, DllName)
{
	WinGet, PID, PID, %Title%
	Return MemoryGetAddrPID(PID, DllName)
}

SetPrivilege(privilege = "SeDebugPrivilege")
{
	success := DllCall("advapi32.dll\LookupPrivilegeValueA","uint",0,"str",privilege,"int64*",luid_SeDebugPrivilege)
	if (success = 1) && (ErrorLevel = 0)
	{
		returnval = 0
	}
	else
	{
		returnval = %ErrorLevel%
	}
	return %returnval%
}

SuspendProcess(hwnd)
{
	return DllCall("ntdll\NtSuspendProcess","uint",hwnd)
}

ResumeProcess(hwnd)
{
	return DllCall("ntdll\NtResumeProcess","uint",hwnd)
}

Cheat engine.ahk

IF NOT A_IsAdmin
{
   Run *RunAs "%A_ScriptFullPath%"
   ExitApp
}


Cheat_Engine_Dynamic_Pointer_Catcher(CH_Path,CH_title,Exe_name,Game_tile,vlaue,move_dir,vlaue2)
{
SoundBeep 
WinMinimizeAll
WinActivate, %Game_tile%
Run, %CH_Path%
WinWaitActive, %CH_title%
Winmove,%CH_title%,,0,0,50,50

ControlClick, Window3, %CH_title%,,,, NA
Sleep, 500
ControlFocus, LCLListBox1, %CH_title%
Sleep, 500
Send, %Exe_name%
Sleep, 1000
Send, {enter}
ControlSetText, Edit1, %vlaue%, %CH_title%
Sleep, 500
ControlClick, Button15, %CH_title%,,,, NA

Loop
{
ControlGetText, Button15_1, Button15,%CH_title% 
IF (Button15_1 = "New Scan")
{
WinActivate, %Game_tile%
WinWaitActive, %Game_tile%
Sleep, 500
Send, {%move_dir%}
break
}
}

WinActivate, %CH_title%
ControlGetText, Button15, Button15,%CH_title%

Loop
{
IF (Button15 = "New Scan")
{
ControlSetText, Edit1,%vlaue2%, %CH_title%
Sleep, 500
ControlClick, Button6, %CH_title%,,,, NA
Sleep, 500

ControlClick, x32 y115, %CH_title%,,,, NA
ControlClick, x32 y115, %CH_title%,,,, NA
Sleep, 400
Click 225, 423, 2
Sleep, 400
send, {ctrl down}
send, {C}
send, {ctrl up}

Process,Close,cheatengine-x86_64.exe
Process,Close,cheatengine-i386.exe
Process,Close,Cheat Engine.exe

NormPoint := Clipboard
coord1 := format( "0x{}", format( "{}", "0x" clipboard ) ) 
Clipboard = %NormPoint%
FileAppend,Pointer: %NormPoint%`nHex Pointer: %coord1%`n`n,%Game_tile%_Dynamic_pointers.ini
TrayTip,%CH_title% Dynamic Pointer Catcher, Catched it!`n`nPointer: %NormPoint%`nHex Pointer: %coord1%,3
break
}

}
}
ExitApp
return

Escape::ExitApp
Edited by SnowFlake

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...