Getting unexpected value when reading Integer

Want Cheat Engine to do something specific and no idea how to do that, ask here. (From simple scripts to full trainers and extensions)
Post Reply
naWik
What is cheating?
What is cheating?
Posts: 4
Joined: Mon Dec 13, 2021 5:53 pm
Reputation: 1

Getting unexpected value when reading Integer

Post by naWik »

Hello. I wanted to learn more about Lua and Cheat engine so I got a Lua book yesterday and started learning a little on my own.

As a basic first test ever I am simply trying to get the 2 byte value at the address 009188A4 which cheat engine shows as 2400 on the address list but when using ReadSmallInteger I get 1024 instead.

Code: Select all

testaddress = ("[bio4.exe+8388A4]")
value1 = ReadSmallInteger(testaddress)
value2 = ReadInteger(testaddress)
value3 = ReadQword(testaddress)
value4 = ReadFloat(testaddress)
value5 = ReadDouble(testaddress)
value6 = ReadBytes(testaddress)

print("Read Small Integer: ".. value1.."\n","Read Integer: "..value2.."\n","Read Qword: "..value3.."\n","Read Float: ".. value4.."\n","Read Double: "..value5.."\n","Read bytes: ".. value6)
Can someone let me know what I am doing or expecting wrong?

ShyTwig16
Expert Cheater
Expert Cheater
Posts: 335
Joined: Thu Apr 06, 2017 7:14 pm
Reputation: 19

Re: Getting unexpected value when reading Integer

Post by ShyTwig16 »

In CE "[ ]" has a special meaning, using "DEADBEEF" as the address CE will look at the acual address "DEADBEEF". But using "[DEEADBEEF]" as the address CE will look at the address stored at "DEEADBEEF" (i.e.: "[DEEADBEEF]" is a pointer with an offset of 0).

Try something like this:

Code: Select all

testaddress = "bio4.exe+8388A4"
value1 = ReadSmallInteger(testaddress)
value2 = ReadInteger(testaddress)
value3 = ReadQword(testaddress)
value4 = ReadFloat(testaddress)
value5 = ReadDouble(testaddress)
value6 = ReadBytes(testaddress, 1)

print("Read Small Integer:", value1)
print("Read Integer:", value2)
print("Read Qword:", value3)
print("Read Float:", value4)
print("Read Double:" value5)
print("Read bytes:", value6)

naWik
What is cheating?
What is cheating?
Posts: 4
Joined: Mon Dec 13, 2021 5:53 pm
Reputation: 1

Re: Getting unexpected value when reading Integer

Post by naWik »

Resolved thank you very much. I missed that looking at Wiki cheat engine and didn't pick it up looking at the other LUA threads ><

Post Reply

Who is online

Users browsing this forum: No registered users