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 


how to compute offsets from address strings?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
dinsmoreb
How do I cheat?
Reputation: 0

Joined: 06 Aug 2011
Posts: 1

PostPosted: Sat Aug 27, 2011 10:25 am    Post subject: how to compute offsets from address strings? Reply with quote

For some reason I can't seem to figure out how I can compute an offset from an address returned by the AOBScan.

local myid = getProcessIDFromProcessName("test.exe")
openProcess(myid)
results = AOBScan("00 00 BC 41 00 00 B1 45 00 00 B0 41 0C 01 00 00")
address = stringlist_getString(results,0)

now that I have the address as a string stored in the variable called address how do I convert the variable to hex to calculate offsets? for e.g. addresss+02.

_________________
jmpXor
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25262
Location: The netherlands

PostPosted: Sat Aug 27, 2011 10:49 am    Post subject: Reply with quote

that address is in string form.
You have 2 options. You pass the string as a string to the routine that makes use of it, or convert it to a integer.

if you use the string method:
address = address .. "+02"
and then pass address on to readInteger, writeInteger, etc... (they can handle string input in CE format)

or you can convert it to an integer:
address=tonumber( "0x" .. address)+2

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
GH*master
Expert Cheater
Reputation: 8

Joined: 10 Jan 2008
Posts: 159

PostPosted: Sat Aug 27, 2011 4:38 pm    Post subject: Reply with quote

Code:
   processName = 'test.exe'
   openProcess(processName)

   stringList = AOBScan("00 00 BC 41 00 00 B1 45 00 00 B0 41 0C 01 00 00")
   if strings_getCount(stringList)>0 do
      address = '0x'..stringlist_getString(stringList,0)
      address = address + 2
      ...
   end
   ...


Last edited by GH*master on Sat Aug 27, 2011 4:52 pm; edited 2 times in total
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25262
Location: The netherlands

PostPosted: Sat Aug 27, 2011 4:46 pm    Post subject: Reply with quote

ah, that actually works, didn't know lua would do that
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
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