[AutoIt]Reading Value From Memory

06/27/2012 15:09 eienheart#1
Hi, I would like some help on a simple bot I'm making.
Code:
#cs ---------------------------------------------------------------------------- 
   AutoIt Version: 1.5.0.0 
   Author: eienheart
#ce ---------------------------------------------------------------------------- 
#include <nomadmemory.au3> 

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

   Global $HPROCESS = _MEMORYOPEN($PID) 
   Global $StaticOffset = 0x008256FC 
   Global $baseaddress = _MemoryModuleGetBaseAddress($PID, "game.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) 

   [I]////////////////////////////other codes here[/I]
WEnd 
_MemoryClose($PID) 
EndFunc
It doesn't output(through messagebox) my desired value(HP).
Am I missing something here?