Memory Functions
Note that many of the functions here are very similar to each other. The only real difference between functions like memoryReadByte() and memoryReadInt() is the size (number of bytes) they read from the target process's memory space. You should use memory searching/editing software such as ArtMoney or Cheat Engine to figure out the size of the data type you are trying to read before you use these functions; reading the wrong number of bytes can result in erroneous information.
Contents
memoryReadByte
byte memoryReadByte(handle, address)
Reads a single byte (-128 -> +127) from the specified process handle and address. The specified address may be in either decimal or hexadecimal form.
'handle' should be the variable that you obtained using openProcess().
Example
-- This will read 0x0D2E0F90 on MyProcess and store it into HP
HP = memoryReadByte( myProcess, 0x0D2E0F90);
if( HP <= 100 ) then
printf("Hp[%d] dropping too low!",HP);
end
memoryReadShort
short memoryReadShort(handle, address)
Reads a short (2 bytes, -32,768 -> +32,767) from the specified process handle and address. The specified address may be in either decimal or hexadecimal form.
'handle' should be the variable that you obtained using openProcess().
Example
-- This will read 0x0D2E0F90 on MyProcess and store it into HP
HP = memoryReadShort( myProcess, 0x0D2E0F90);
if( HP <= 100 ) then
printf("Hp[%d] dropping too low!",HP);
end
memoryReadInt
int memoryReadShort(handle, address)
Reads an int (4 bytes, -2,147,483,648 -> +2,147,483,647) from the specified process handle and address. The specified address may be in either decimal or hexadecimal form.
'handle' should be the variable that you obtained using openProcess().
Example
-- This will read 0x0D2E0F90 on MyProcess and store it into HP
HP = memoryReadInt( myProcess, 0x0D2E0F90);
if( HP <= 100 ) then
printf("Hp[%d] dropping too low!",HP);
end
memoryReadUInt
unsigned int memoryReadShort(handle, address)
Exactly like memoryReadInt(), except it returns an unsigned int (0 -> +4,294,967,295).
'handle' should be the variable that you obtained using openProcess().
Example
-- This will read 0x0D2E0F90 on MyProcess and store it into HP
HP = memoryReadUInt( myProcess, 0x0D2E0F90);
if( HP <= 100 ) then
printf("Hp[%d] dropping too low!",HP);
end
memoryReadFloat
float memoryReadFloat(handle, address)
Reads a float (floating point integer - may contain values such as 1.5 or 192083.0) from the specified process handle and address. The specified address may be in either decimal or hexadecimal form.
'handle' should be the variable that you obtained using openProcess().
Example
-- This will read 0x0D2E0F90 on MyProcess and store it into HP
HP = memoryReadFloat( myProcess, 0x0D2E0F90);
if( HP <= 100 ) then
printf("Hp[%d] dropping too low!",HP);
end
memoryReadString
string memoryReadString(handle, address)
Reads a NULL-terminated string from the specified process handle and address. Make sure it's NULL-terminated, or you will get an infinite loop! The specified address may be in either decimal or hexadecimal form.
'handle' should be the variable that you obtained using openProcess().
Example
-- This will read 0x0D2E0F90 on MyProcess and store it into name
name = memoryReadString( myProcess, 0x0D2E0F90);
printf("Your character\'s name is %s\n", name);
memoryReadBytePtr
byte memoryReadBytePtr(handle, address, offset)
Reads a single byte from the specified address + offset from process denoted by 'handle'. This is exactly like memoryReadByte except that it reads from a pointer. If you do not need an offset, call this function with the offset parameter as 0.
'handle' should be the variable that you obtained using openProcess().
Example
-- This will read (*0x0D2E0F90) + 0xA8 on MyProcess and store it into HP
HP = memoryReadBytePtr( myProcess, 0x0D2E0F90, 0xA8);
if( HP <= 100 ) then
printf("Hp[%d] dropping too low!",HP);
end
memoryReadShortPtr
short memoryReadShortPtr(handle, address, offset)
Reads a short from the specified address + offset from process denoted by 'handle'. This is exactly like memoryReadShort except that it reads from a pointer. If you do not need an offset, call this function with the offset parameter as 0.
'handle' should be the variable that you obtained using openProcess().
Example
-- This will read (*0x0D2E0F90) + 0xA8 on MyProcess and store it into HP
HP = memoryReadShortPtr( myProcess, 0x0D2E0F90, 0xA8);
if( HP <= 100 ) then
printf("Hp[%d] dropping too low!",HP);
end
memoryReadIntPtr
int memoryReadIntPtr(handle, address, offset)
Reads an int from the specified address + offset from process denoted by 'handle'. This is exactly like memoryReadInt except that it reads from a pointer. If you do not need an offset, call this function with the offset parameter as 0.
'handle' should be the variable that you obtained using openProcess().
Example
-- This will read (*0x0D2E0F90) + 0xA8 on MyProcess and store it into HP
HP = memoryReadIntPtr( myProcess, 0x0D2E0F90, 0xA8);
if( HP <= 100 ) then
printf("Hp[%d] dropping too low!",HP);
end
memoryReadUIntPtr
unsigned int memoryReadIntPtr(handle, address, offset)
Reads an unsigned int from the specified address + offset from process denoted by 'handle'. This is exactly like memoryReadUInt except that it reads from a pointer. If you do not need an offset, call this function with the offset parameter as 0.
'handle' should be the variable that you obtained using openProcess().
Example
-- This will read (*0x0D2E0F90) + 0xA8 on MyProcess and store it into HP
HP = memoryReadUIntPtr( myProcess, 0x0D2E0F90, 0xA8);
if( HP <= 100 ) then
printf("Hp[%d] dropping too low!",HP);
end
memoryReadFloatPtr
float memoryReadFloatPtr(handle, address, offset)
Reads a float from the specified address + offset from process denoted by 'handle'. This is exactly like memoryReadFloat except that it reads from a pointer. If you do not need an offset, call this function with the offset parameter as 0.
'handle' should be the variable that you obtained using openProcess().
Example
-- This will read (*0x0D2E0F90) + 0xA8 on MyProcess and store it into HP
HP = memoryReadUIntPtr( myProcess, 0x0D2E0F90, 0xA8);
if( HP <= 100 ) then
printf("Hp[%d] dropping too low!",HP);
end
memoryReadStringPtr
float memoryReadStringPtr(handle, address, offset)
Reads a NULL-terminated string from the specified address + offset from process denoted by 'handle'. This is exactly like memoryReadString except that it reads from a pointer. If you do not need an offset, call this function with the offset parameter as 0.
'handle' should be the variable that you obtained using openProcess().
Example
-- This will read (*0x0D2E0F90) + 0xA8 on MyProcess and store it into name
name = memoryReadUIntPtr( myProcess, 0x0D2E0F90, 0xA8);
printf("Your character\'s name is", name);