what i want to do?
i want to get the current value of MP / HP.
but my code doesnt give me the correct value, its always = 0
here is my own code
though the $Addr_CheckLogin, $Addr_CheckCharName is static so no problem with that.. but my problem is with the dynamic addresses that need offset and base address stuff.
I saw this code somewhere, and I'm trying to edit it to work with the game I'm playing. I have the Base Address and My Offsets, but i have a problem.
i don't know how to complete the code.
please help?
this is the information about my address and offset,
i just used a generator to get this autoit function. i dont even understand much of this. but can someone help merge this code with the code above? thanks...
i want to get the current value of MP / HP.
but my code doesnt give me the correct value, its always = 0
here is my own code
though the $Addr_CheckLogin, $Addr_CheckCharName is static so no problem with that.. but my problem is with the dynamic addresses that need offset and base address stuff.
Code:
#include <NomadMemory.au3>
#include <GUIConstants.au3>
#include <GUIListBox.au3>
#include <Misc.au3>
#include <Array.au3>
#include <asm.au3>
#include <basememory.au3>
;#RequireAdmin
;Declaring Variables
Global $MemPointer, $finalADDR, $baseADDR
;Check if Khan Online is running.
If ProcessExists("KhanClient.exe") = 0 Then
MsgBox(0, "Error", "Khan Online is not running. Please start Khan first.")
Exit
EndIf
;Get Khan Process and Open Memoryz
$ID=_MemoryOpen(ProcessExists("KhanClient.exe"))
;Function Calls
_ReadCurHP($ID)
;Addresses
$Addr_CheckLogin=0x0184B30C
$Addr_CheckCharName=0x00718DB4
$Addr_Exp=0x006F526E
;$Addr_CurHP=0x006F532C
$Addr_FullHP=0x006F5330
;$Addr_CurMP=0x
$Addr_FullMP=0x006F5356
;Check If Logged in to Khan
$Check_Login=_MemoryRead($Addr_CheckLogin,$ID)
If $Check_Login = "" Then
MsgBox(0x1010, "Error", "Please Login.")
Exit
EndIf
;Check Selected Character Name
$Check_CharName=_MemoryRead($Addr_CheckCharName,$ID)
If $Check_CharName = "" Then
MsgBox(0x1010, "Error", "Please Select Character.")
Exit
EndIf
;Display Character Selected
$Char_Chosen=_MemoryRead($Addr_CheckCharName, $ID, "Char[21]")
MsgBox(0, "Character Chosen",$Char_Chosen)
;Display Characters Current Exp
$Char_Exp=_MemoryRead($Addr_Exp, $ID, "Char[31]")
MsgBox(0, "Character EXP",$Char_Exp)
;Display Characters Current HP
$Char_CurHP=_MemoryRead($Addr_Exp, $ID, "Char[31]")
MsgBox(0, "Character HP",$baseADDR)
;functions for getting offsets
Func _ReadCurHP($ID)
Global $CurHPOffset[6]
$CurHPOffset[0] = 0
$CurHPOffset[1] = Dec("017C")
$CurHPOffset[2] = Dec("0108")
$CurHPOffset[3] = Dec("0004")
$CurHPOffset[4] = Dec("0004")
$CurHPOffset[5] = Dec("0020")
$StaticOffset = Dec("0030EA80")
$openmem = _MemoryOpen($ID)
$baseADDR = _MemoryGetBaseAddress($openmem, 1)
$finalADDR = "0x" & Hex($baseADDR + $StaticOffset)
$MemPointer = _MemoryPointerRead($finalADDR, $openmem, $CurHPOffset)
_MemoryClose($openmem)
Return $MemPointer
EndFunc
i don't know how to complete the code.
please help?
Code:
#include <NomadMemory.au3>
$h=WinGetHandle("[CLASS:ZElementClient Window]","")
$pid = ProcessExists("elementclient.exe")
$pointer = Dec("00AF9094")
$offset = Dec("28")
$hp_current = Dec("270")
$hp_max = Dec("288")
$mp_current = Dec("274")
$mp_max = Dec("28C")
$openmem = _MemoryOpen($pid)
$base=_MemoryRead($pointer,$openmem)
$offsetADDR = "0x" & Hex($offset + $base)
$finalADDR=_memoryread($offsetADDR,$openmem)
$hp_current_ADDR = "0x" & Hex($hp_current + $finalADDR)
$hp_max_ADDR = "0x" & Hex($hp_max + $finalADDR)
$mp_current_ADDR = "0x" & Hex($mp_current + $finalADDR)
$mp_max_ADDR = "0x" & Hex($mp_max + $finalADDR)
i just used a generator to get this autoit function. i dont even understand much of this. but can someone help merge this code with the code above? thanks...
Code:
Func _ReadCurMP($pid)
Global $CurMPOffset[6]
$CurMPOffset[0] = 0
$CurMPOffset[1] = Dec("017C")
$CurMPOffset[2] = Dec("010C")
$CurMPOffset[3] = Dec("0004")
$CurMPOffset[4] = Dec("0004")
$CurMPOffset[5] = Dec("0020")
$StaticOffset = Dec("0030EA80")
$openmem = _MemoryOpen($pid)
$baseADDR = _MemoryGetBaseAddress($openmem, 1)
$finalADDR = "0x" & Hex($baseADDR + $StaticOffset)
$MemPointer = _MemoryPointerRead($finalADDR, $openmem, $CurMPOffset)
_MemoryClose($openmem)
Return $MemPointer
EndFunc