I am trying to access a static address in the LOTRO client using process.read, however I am having trouble understanding how to get the base address of the client and then adding the address to it to get the correct address to read from.
CE says the static address is at lotroclient.exe+1561154
So I tried the following
Administrator wrote:How is it invalid, nil or is it giving the wrong address? What is getModuleAddress() returning? What happens if you print lotroBase + staticAddress?
After doing some debugging I found out getModuleAddress() is returning the correct address and when I add the static address I get the correct address as displayed by CE, however the value I get when reading the memory from that address is drastically different than the value CE displays. CE display a float ranging from -1 to 1, MM displays a number in the thousands. I am going to keep debugging, if you have any tips or guesses I will appreciate it too.
EDIT:
I found my mistake I was reading a ushort instead of a float, I was a bit confused because the online documentation isn't 100% clear about what the variable type can be in process.read() I understand this is because its still in development. Thank you for the help!
Sorry, I might have to clear that up. Still, you want to keep the same type you do in Cheat Engine. So if the variable type is float in CE, read it as a float.
A "short" is a single byte from -127 to 127, and unsigned short is 0 to 255.
signed char: -127 to 127 (note, not -128 to 127; this accommodates 1's-complement platforms)
unsigned char: 0 to 255
"plain" char: -127 to 127 or 0 to 255 (depends on default char signedness)
signed short: -32767 to 32767
unsigned short: 0 to 65535
signed int: -32767 to 32767
unsigned int: 0 to 65535
signed long: -2147483647 to 2147483647
unsigned long: 0 to 4294967295
signed long long: -9223372036854775807 to 9223372036854775807
unsigned long long: 0 to 18446744073709551615
Not wrong, it's just there's some information missing.
A long and int are the same thing (in C++). Usually. It depends on platform, though nowadays I think it would be hard to find one where they are different. Many years ago, an int could be 4 bytes on one platform and 2 on another. Now it is standardized as 4 bytes (ie. long).