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 


Search for relative pointer as aob

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
sbryzl
Master Cheater
Reputation: 6

Joined: 25 Jul 2016
Posts: 252

PostPosted: Wed Mar 02, 2022 8:04 pm    Post subject: Search for relative pointer as aob Reply with quote

Can't do this in aa so was hoping it was something lua can handle. Just trying to get the location of the pointer. Don't know lua so what I am trying doesn't work. "game.exe+800" just gets scanned for as a string and I need to scan the pointer as though it's broken into bite size chunks. Say for example:
game.exe= 6644221100
then it would need to search for
00 19 22 44 66,
though of course game.exe could be in a different location and the aob would have to be different.

Code:
[ENABLE]

{$lua}
if syntaxcheck then return end

scnr = AOBScan("game.exe+800")
registerSymbol("loc1",scnr[0])
print(scnr[0])
scnr.destroy()
{$asm}


[DISABLE]

unregisterSymbol(loc1)
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4706

PostPosted: Wed Mar 02, 2022 11:19 pm    Post subject: This post has 1 review(s) Reply with quote

Code:
[ENABLE]
{$lua}
if syntaxcheck then return 'define(foo,0)' end

local bytes = qwordToByteTable(getAddress'game.exe+800')

for i,v in pairs(bytes) do
  bytes[i] = ('%02X'):format(v)
end

local results = assert(AOBScan(table.concat(bytes, ' ')), 'No AOB results found')
if results.Count > 1 then
  results.destroy()
  error'Multiple AOB results found'
end

local address = getAddress(results[0])
results.destroy()

return ('define(foo,%08X)'):format(address)
{$asm}

// you could also do this in Lua, but this should work
registersymbol(foo)

foo:
  // whatever

_________________
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
sbryzl
Master Cheater
Reputation: 6

Joined: 25 Jul 2016
Posts: 252

PostPosted: Thu Mar 03, 2022 6:33 pm    Post subject: Reply with quote

Thank you, works perfect.
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