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 


I'm a newb, help me turn a aobscan into a label ptr pls

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
zxuiji
Advanced Cheater
Reputation: 1

Joined: 26 Sep 2016
Posts: 70

PostPosted: Sat Jan 06, 2018 12:54 pm    Post subject: I'm a newb, help me turn a aobscan into a label ptr pls Reply with quote

I managed to get as far as this:
aobscanmodule(zHPWrAOB,LRFF13.exe,8B 80 98 0C 00 00 E9)
Which is giving me errors of a malformed number for some reason, by
modifying a copy of some code from an existing table I downloaded, I'm fine with finding addresses for raw values but I wanna leave that amateur phase and enter the semi-expert phase (i.e. able to create/use pointers to auto fill inventory etc but not writing assembly stage)

_________________
Those who do not trust in christ to save them from their sins will only experience hell when their soul is released from it's earthly vessel.
Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 50

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Sat Jan 06, 2018 1:41 pm    Post subject: Reply with quote

If this is Auto Assembler code then this is fine, but if you are using this as Lua code then it's a little different. First off the assembler will read all numbers as hex by default, but Lua reads all numbers as a decimal. Second the Lua "AOBScan" scans the process and returns a "StringList" object containing all the results (not just the first). It takes a Lua sting object or bytes.

Code:
local results = AOBScan('4B 5F 68 12 FE 36')

Code:
local results = AOBScan('4B 5F 68 12 FE 36', '+W-C')

Code:
local results = AOBScan('E8 ** ** ** ** E8', '+X-C-W')


Code:
local results = AOBScan(0x4B, 0x5F, 0x68, 0x12, 0xFE, 0x36)


AOBScan

And if you wish to stay a way from assembler then the "celua.txt" file in your Cheat Engine folder is a good place to start.

Or the Wiki.

Lua

_________________
Back to top
View user's profile Send private message Visit poster's website
zxuiji
Advanced Cheater
Reputation: 1

Joined: 26 Sep 2016
Posts: 70

PostPosted: Sat Jan 06, 2018 3:32 pm    Post subject: Reply with quote

Wow didn't expect such a fast reply, anyways took what you said into account, did some searching to get other information I needed then hit another stumbling block which is the attached PNG, here's the entirety of my code:
[code]
function zAOBAddr( T, ADDSUB )
if ( (T == nil) or (T.Count == 0) ) then
return '[0]' ADDSUB
end
return '[' T[0] ']' ADDSUB
end

local zHP_AOB = AOBScan("8B 80 98 0C 00 00 E9")
local zFoes_AOB = AOBScan("A0 A0 00 00 A1 2F 00 00")

local zHP = zAOBAddr( zHP_AOB, '-4' )
local zFoes = zAOBAddr( zFoes_AOB, '' )

local pHP = readInteger(zHP)
local rHP = '[' pHP ']+9C8'
[/code]
Problem is in the function but I figured that I probably made mistakes further down the line as well and rather than make an extra post for them later I'd rather just get the help simultaneously if needed

[b]Edit:[/b] Popping down to KFC so don't feel rushed
[b]Edit 2:[/b] Realized it was missing the ..
[b]Edit 3:[/b] Google didn't help, how do I register named pointers? i.e. when I type the name into the address box it shows the address held by the name



error.png
 Description:
Cropped screenshot of error
 Filesize:  14.12 KB
 Viewed:  3710 Time(s)

error.png



_________________
Those who do not trust in christ to save them from their sins will only experience hell when their soul is released from it's earthly vessel.
Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 50

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Sat Jan 06, 2018 4:46 pm    Post subject: Reply with quote

It's the parts after the returns, to concatenate strings in Lua use ".."
Code:
function zAOBAddr( T, ADDSUB )
  if ( (T == nil) or (T.Count == 0) ) then
     return '[0]' .. ADDSUB
  end
  return '['.. T[0].. ']'.. ADDSUB
end

_________________
Back to top
View user's profile Send private message Visit poster's website
zxuiji
Advanced Cheater
Reputation: 1

Joined: 26 Sep 2016
Posts: 70

PostPosted: Sat Jan 06, 2018 4:51 pm    Post subject: Reply with quote

Whoops forgot to refresh the page, anyways thanks for the reply, just having trouble identifying how to add named pointers for the address box now.
_________________
Those who do not trust in christ to save them from their sins will only experience hell when their soul is released from it's earthly vessel.
Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 50

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Sat Jan 06, 2018 5:06 pm    Post subject: Reply with quote

registerSymbol
_________________
Back to top
View user's profile Send private message Visit poster's website
zxuiji
Advanced Cheater
Reputation: 1

Joined: 26 Sep 2016
Posts: 70

PostPosted: Sat Jan 06, 2018 6:51 pm    Post subject: Reply with quote

Guess I was on the right track after all, must be just how I'm passing the parameters, thanks for linking to the docs though, always had trouble finding documentation on the API which was why I delayed learning it ever since I started using cheat engine. I'll take another crack at it tomorrow after I get some sleep.
_________________
Those who do not trust in christ to save them from their sins will only experience hell when their soul is released from it's earthly vessel.
Back to top
View user's profile Send private message
zxuiji
Advanced Cheater
Reputation: 1

Joined: 26 Sep 2016
Posts: 70

PostPosted: Sun Jan 07, 2018 6:26 am    Post subject: This post has 1 review(s) Reply with quote

Got it! (I think :D) For reference here's my code:
Code:

function zAOBAddr( T, ADDSUB )
   if ( (T == nil ) or (T.Count == 0) ) then
        return nil
   end
   return ('' .. T[0] .. '' .. ADDSUB)
end

function zSymbol( name, value )
         if ( name == nil ) then return end
         unregisterSymbol( name )
         if ( (value == nil) or (value == 0) ) then return end
         registerSymbol( name, value )
end

local zHP_AOB = AOBScan("8B 80 98 0C 00 00 E9")
local zFoes_AOB = AOBScan("A0 A0 00 00 A1 2F 00 00")

local zHP = zAOBAddr( zHP_AOB, '-4' )
local pFoes = zAOBAddr( zFoes_AOB, '' )

local pHP = readInteger(zHP)
local rHP = '' .. (pHP or 0) .. '+9C8'

zSymbol( 'pHP', pHP )
zSymbol( 'pFoes', pFoes )

Further issues should be just lua related for the time being but this is enough to get me started on the semi-expert phase. I'll check back later in case a potential problem is spotted and pointed it out in another post.

_________________
Those who do not trust in christ to save them from their sins will only experience hell when their soul is released from it's earthly vessel.
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