Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


LUA - syntax error - Hex String subtraction

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
jadereporter
Newbie cheater
Reputation: 0

Joined: 17 Sep 2016
Posts: 13

PostPosted: Tue Sep 20, 2016 8:01 am    Post subject: LUA - syntax error - Hex String subtraction Reply with quote

Hello,

Code:
myscan = AOBScan("50 51 A7 7F 8E 00 00 00");

print(myscan[0]); -- result 8E02C10028... it's OK... all right

print(myscan[0] -0x40); -- syntax error ... it's Not OK .. :(




how to subtract Hex Adress at that value?

I find the lower Hex Adress 64 units (0x40) ...

Another thing. After finding the address should I read the value?

With what command reads the value? (string, float, 8bytes, 4bytes, ect ...)
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4300

PostPosted: Tue Sep 20, 2016 8:08 am    Post subject: Reply with quote

It's a string. Use type() to get the type of a value and tonumber() to convert a string to a number.
Code:
tonumber(myscan[0],16) - 0x40

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
jadereporter
Newbie cheater
Reputation: 0

Joined: 17 Sep 2016
Posts: 13

PostPosted: Tue Sep 20, 2016 8:29 am    Post subject: Reply with quote

Thank you.

It's similar to the Javascript command parseInt(hexString, 16).

Now as I read the value of that address?

The second address has a variable value.
I use the first address that has the same value as always.
But what I read is the second.

** I apologize if I write when you do not understand. I use an English translator.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4300

PostPosted: Tue Sep 20, 2016 8:36 am    Post subject: Reply with quote

What is the value type of the second address?
Code:
readInteger(address)  -- 4-byte
readFloat(address)    -- float
readDouble(address)   -- double
readString(address)   -- string
readBytes(address,n)  -- raw bytes

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites