Page 1 of 1
AutoIt discussion
Posted: June 15th, 2011, 7:51 am
by spagetiokillers
ok so i opened up cheat engine and i was able to get it to read my health there nut when i put this
Code: Register to unlock hidden link
Global $Health[3] = ["1BD2F20", "570", "0"]
Global $HealthTotal[3] = ["1BD2F20", "5A8", "0"]
into my autoit and try to display it on a label all it shows it 0
i have this for my code
Code: Register to unlock hidden link
Global $Health[3] = ["1BD2F20", "570", "0"]
Global $HealthTotal[3] = ["1BD2F20", "5A8", "0"]
Global $ID
$ID = _MemoryOpen(ProcessExists("SwgClient_r.exe"))
$CurrentHP = _MemoryRead($Health,$ID)
$MaxHP = _MemoryRead($HealthTotal,$ID)
$Label3 = GUICtrlCreateLabel("" & $CurrentHP, 56, 80, 75, 17)
$Label5 = GUICtrlCreateLabel("" & $MaxHP, 224, 40, 75, 17)
am i doing something wrong here? BTW this isnt my full code just the code that deals with this.
Re: AutoIt discussion
Posted: June 15th, 2011, 9:14 am
by evilfigment
I'd help but i've never even glanced at autoit so i aint got a clue, i can help people willing to learn the C/C++ way though...
Heres something i posted on another site about 4 years ago...
Code: Register to unlock hidden link
/*
Example:
dwAddressOfHealth = GetPointerEx( hOpenedGame, 0x1BD2F20, 2, 0x570, 0 );
*/
#define MAX_PTR_LEVEL 12
DWORD GetPointerEx ( HANDLE hGameProc, DWORD BasePtr, int Level, ...)
{
BYTE buf[ sizeof( DWORD ) ];
DWORD dwPrev;
va_list arglist;
DWORD arg[MAX_PTR_LEVEL];
int i, j;
if( !hGameProc || Level < 1 || Level > MAX_PTR_LEVEL )
return NULL;
va_start ( arglist, Level );
for ( i = Level, j = 0; i > 0; i-- )
arg[j++] = va_arg ( arglist, DWORD );
va_end ( arglist );
dwPrev = BasePtr;
for( i = 0; i < Level; i++ )
{
*(DWORD*)buf = 0;
if(!(ReadProcessMemory( hGameProc, (LPCVOID)dwPrev, buf, sizeof(DWORD), NULL )))
return NULL;
dwPrev = ( *(DWORD*)buf + arg[i] );
if( dwPrev <= 0 || dwPrev == arg[i] )
return NULL;
}
return ( dwPrev );
}
^ That would get the address that contains the health, which you can then read using something like this..
Code: Register to unlock hidden link
// Example:
// printf( "Your Health is: %i\n", GetIntEx( dwAddressOfHealth ) );
float GetIntEx( HANDLE hGameProc, DWORD dwAddr )
{
int ret;
BYTE buf[ sizeof( int ) ];
if( !( ReadProcessMemory( hGameProc, (void*)dwAddr, buf, sizeof(int), NULL ) ) )
return NULL;
ret = *(int*)buf;
memset( buf,0, sizeof(int) );
return ret;
}
Re: AutoIt discussion
Posted: June 15th, 2011, 10:25 am
by spagetiokillers
ok i tried something different from some tuts i found and came out with these errors
ERROR: _MemoryGetBaseAddress(): undefined function.
and
ERROR: _MemoryPointerRead(): undefined function.
i cant figure this out shouldnt this work with NomadMemory? or do i need another thing for these commands
Re: AutoIt discussion
Posted: June 16th, 2011, 5:27 pm
by spagetiokillers
no one can help me with this? this is all i cant get to work.
Re: AutoIt discussion
Posted: June 16th, 2011, 7:32 pm
by spagetiokillers
spagetiokillers wrote:ok i tried something different from some tuts i found and came out with these errors
ERROR: _MemoryGetBaseAddress(): undefined function.
and
ERROR: _MemoryPointerRead(): undefined function.
i cant figure this out shouldnt this work with NomadMemory? or do i need another thing for these commands
i was able to figure out how to stop the _memoryGetBaseAddress() error but i still have the other one
Re: AutoIt discussion
Posted: June 16th, 2011, 7:57 pm
by spagetiokillers
i think i know why its not working my NomadMemory doesnt have a func for MemoryPointerRead isnt it suuposed to?
Re: AutoIt discussion
Posted: June 16th, 2011, 8:21 pm
by spagetiokillers
ok i found the pointer code and got ride of all my errors and so this is the code i have but it still doesnt work
$ID = ProcessExists("SwgClient_r.exe")
If $ID > 0 Then
Global $CurHPOffset[2] = [0, 570]
$StaticOffset = 0x1BD2F20
$openmem = _MemoryOpen($ID)
$baseADDR = _MemoryGetBaseAddress($openmem, 1)
$finalADDR = "0x" & Hex($baseADDR + $StaticOffset)
$HPread = _MemoryPointerRead($finalADDR, $openmem, $CurHPOffset)
_MemoryClose($openmem)
MsgBox(0, "Info", $HPread[1])
EndIf
Re: AutoIt discussion
Posted: June 18th, 2011, 1:59 pm
by spagetiokillers
evilfigment wrote:I'd help but i've never even glanced at autoit so i aint got a clue, i can help people willing to learn the C/C++ way though...
Heres something i posted on another site about 4 years ago...
Code: Register to unlock hidden link
/*
Example:
dwAddressOfHealth = GetPointerEx( hOpenedGame, 0x1BD2F20, 2, 0x570, 0 );
*/
#define MAX_PTR_LEVEL 12
DWORD GetPointerEx ( HANDLE hGameProc, DWORD BasePtr, int Level, ...)
{
BYTE buf[ sizeof( DWORD ) ];
DWORD dwPrev;
va_list arglist;
DWORD arg[MAX_PTR_LEVEL];
int i, j;
if( !hGameProc || Level < 1 || Level > MAX_PTR_LEVEL )
return NULL;
va_start ( arglist, Level );
for ( i = Level, j = 0; i > 0; i-- )
arg[j++] = va_arg ( arglist, DWORD );
va_end ( arglist );
dwPrev = BasePtr;
for( i = 0; i < Level; i++ )
{
*(DWORD*)buf = 0;
if(!(ReadProcessMemory( hGameProc, (LPCVOID)dwPrev, buf, sizeof(DWORD), NULL )))
return NULL;
dwPrev = ( *(DWORD*)buf + arg[i] );
if( dwPrev <= 0 || dwPrev == arg[i] )
return NULL;
}
return ( dwPrev );
}
^ That would get the address that contains the health, which you can then read using something like this..
Code: Register to unlock hidden link
// Example:
// printf( "Your Health is: %i\n", GetIntEx( dwAddressOfHealth ) );
float GetIntEx( HANDLE hGameProc, DWORD dwAddr )
{
int ret;
BYTE buf[ sizeof( int ) ];
if( !( ReadProcessMemory( hGameProc, (void*)dwAddr, buf, sizeof(int), NULL ) ) )
return NULL;
ret = *(int*)buf;
memset( buf,0, sizeof(int) );
return ret;
}
Iv been reading a C++ programming book and i just got a compiler for it and made the Hello World program so far it looks pretty simple. The only language iv learned so far is Delphi and i was messing around with autoit and i figured id take a look at C++ since i have the book.
Re: AutoIt discussion
Posted: June 22nd, 2011, 7:29 pm
by spagetiokillers
im still unable to get it to read anything other than 0 any help would be great