Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[AutoIt]Reading Value From Memory

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
eienheart
How do I cheat?
Reputation: 0

Joined: 25 Jun 2012
Posts: 5

PostPosted: Tue Jun 26, 2012 1:22 pm    Post subject: [AutoIt]Reading Value From Memory Reply with quote

Ok so, I'm trying to make a script that detects and returns the value in the address. But it doesn't give out what I expect it to, it outputs this number:
Quote:
11186898


Using this code:
Code:
#include <NomadMemory.au3>

$StaticOffset = Dec("8256FC") ; "elementclient.exe+8256FC" - CheatEngine formatted static address.
$pid = ProcessExists("elementclient.exe")
$openmem = _MemoryOpen($pid) ; Open the memory
$baseADDR = _MemoryGetBaseAddress($openmem, 1)
$finalADDR = "0x" & Hex($baseADDR + $StaticOffset) ; Creates the final static address you read from.
$value=_MemoryRead($finalADDR, $openmem)
ConsoleWrite($value & @CRLF)
_MemoryClose($openmem)


PS: I'm trying to detect HP values for a game(Jade Dynasty)
So I tried to add these codes:
Code:
$hpcuroff = dec("27c")
$value1=_MemoryRead($finalADDR+$hpcuroff, $openmem)
ConsoleWrite($value1 & @CRLF)

Though it just outputs:
Quote:
4294967295


Can Anyone shed light as to why this happens? And what am I missing?
Back to top
View user's profile Send private message
Kriogenic
Cheater
Reputation: -1

Joined: 13 Jun 2012
Posts: 36
Location: localhost

PostPosted: Tue Jun 26, 2012 8:25 pm    Post subject: Reply with quote

There could be many reasons to why you are getting this value

first when you find your HP value of what type is it? float, double, 4 byte, 8 byte?

you can try in CE double clicking the value type and changing it to 4 byte which will give you the 4 byte representation of the value if that matches your output its because the memory at that address is NOT of type 4 byte
Back to top
View user's profile Send private message
eienheart
How do I cheat?
Reputation: 0

Joined: 25 Jun 2012
Posts: 5

PostPosted: Wed Jun 27, 2012 3:27 am    Post subject: Reply with quote

Code:
#cs ----------------------------------------------------------------------------
   AutoIt Version: 1.4.0.0
   Author: eien
#ce ----------------------------------------------------------------------------
#include <nomadmemory.au3>

$PID = WinGetProcess("Jade Dynasty")
WinActivate("Jade Dynasty") ;bring the game to active window at start
Autopot()
func Autopot()
while WinActive("Jade Dynasty") ;ends script when window isn't active

   Global $HPROCESS = _MEMORYOPEN($PID)
   Global $baseaddress = 0x19147FD0 ;address that accesses my pointer - via CE
   Global $offset1 = 0xxxx ;offset for current hp
   Global $offset2 = 0xxxx ;offset for max hp
   Global $offset3 = 0xxxx ;offset for current mp
   Global $offset4 = 0xxxx ;offset for max mp

   $CurrentHP = _MemoryRead($baseaddress+$offset1, $HPROCESS, "int")
   $MaxHP = _MemoryRead($baseaddress + $offset2, $HPROCESS, "int")
   $CurrentMP = _MemoryRead($baseaddress+$offset3, $HPROCESS, "int")
   $MaxMP = _MemoryRead($baseaddress+$offset4, $HPROCESS, "int")
   ;msgbox(0,"ab",$CurrentHP)

if $CurrentHP < (.9)*($MaxHP) then ;press 8 when HP is below 90%
      Send(8)
EndIf
if $CurrentMP < (.9)*($MaxMP) then ;press 9 when MP is below 90%
      Send(9)
EndIf

WEnd
_MemoryClose($PID)
EndFunc


Ok so I managed to make this work but how can I make it so that I don't need to re-enter a new address ($baseaddress) everytime I re-open the game? I tried using _MemoryGetBaseAddress via NomadMemory.au3 (as my first post shows) but it doesn't seem to return the value I need.

PS: I managed to get the game's address using _MemoryGetBaseAddress, but I can't seem to make it so that it detects the HP of my character.
New Code:
Code:
#cs ----------------------------------------------------------------------------
   AutoIt Version: 1.5.0.0
   Author: eien
#ce ----------------------------------------------------------------------------
#include <nomadmemory.au3>

$PID = WinGetProcess("Jade Dynasty")
WinActivate("Jade Dynasty") ;bring the game to active window at start
Autopot()
func Autopot()
while WinActive("Jade Dynasty") ;ends script when window isn't active

   Global $HPROCESS = _MEMORYOPEN($PID)
   Global $StaticOffset = 0x008256FC
   Global $baseaddress = _MemoryModuleGetBaseAddress($PID, "elementclient.exe");static address that accesses my pointer - via CE
   Global $finalADDR = "0x" & Hex($baseaddress + $StaticOffset)
   Global $offset1 = 0xxxx ;offset for current hp
   Global $offset2 = 0xxxx ;offset for max hp
   Global $offset3 = 0xxxx ;offset for current mp
   Global $offset4 = 0xxxx ;offset for max mp

   $CurrentHP = _MemoryRead($finalADDR+$offset1, $HPROCESS)
   $MaxHP = _MemoryRead($finalADDR + $offset2, $HPROCESS)
   $CurrentMP = _MemoryRead($finalADDR+$offset3, $HPROCESS)
   $MaxMP = _MemoryRead($finalADDR+$offset4, $HPROCESS)
   ;msgbox(0,"ab",$CurrentHP)

if $CurrentHP < (.9)*($MaxHP) then ;press 8 when HP is below 90%
      Send(8)
EndIf
if $CurrentMP < (.9)*($MaxMP) then ;press 9 when MP is below 90%
      Send(9)
EndIf

WEnd
_MemoryClose($PID)
EndFunc
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites