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 


Local Symbol from Custom AA Command

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
panraven
Grandmaster Cheater
Reputation: 55

Joined: 01 Oct 2008
Posts: 941

PostPosted: Sun Aug 02, 2015 12:16 am    Post subject: Local Symbol from Custom AA Command Reply with quote

How to define a local symbol in a custom AA command?

For example, I define a custom aobscan,said MyScan, return 1st matched address on success, and suppose to assign to a local symbol in the aa script.
I try with this AA Lines:
Code:

label(symbol)
10400000: // result address
symbol:

the custom aa command is define like this
Code:

function split(s,sep)...end
function customScan(...)...end
function MyScan(scriptLine, checkSyntax)
  local symbol,aob = unpack(split(scriptLine,','))
  local Result
  if checkSyntax==true then
    Result = 0x20000 -- fake result for syntaxcheck
  else
    Result = customScan(aob)  -- address of integer type or nil on fail
  end
 
  assert(Result~=nil)

-- return result lines for aa
  return string.format([[
label(%s)
%X:
%s:
]],symbol,Result,symbol)
end

registerAutoAssembleCommand('MyScan',MyScan)
-- pseudo code, ignore typo or syntax error pls


It work with the AA Command execute alone, but not work if the local symbol is referred by following aa script.

If the result line is paste on the AA script, it work as expected.

It seems when execute as an AA Command, the result lines is not yet ready when other following aa script line referring the local symbol.

It can be done with lua version registerSymbol, but I want to simulate exactly the local symbol behavior.

Thank you~

_________________
- Retarded.
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: Sun Aug 02, 2015 2:09 am    Post subject: Reply with quote

the way the local symbol handler functions is that every thing that can create a local symbol will check if the current line contains that symbol and if so, replace it with the hexadecimal value


to do what you want you'll have to use registerAutoAssemblerPrologue
in there first scan for your command, handle it, and replace all instances of the given variable with the outout

_________________
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
panraven
Grandmaster Cheater
Reputation: 55

Joined: 01 Oct 2008
Posts: 941

PostPosted: Sun Aug 02, 2015 2:35 am    Post subject: Reply with quote

Dark Byte wrote:
the way the local symbol handler functions is that every thing that can create a local symbol will check if the current line contains that symbol and if so, replace it with the hexadecimal value


to do what you want you'll have to use registerAutoAssemblerPrologue
in there first scan for your command, handle it, and replace all instances of the given variable with the outout


I see.

Some more questions, it seems using define(symbol, address) also can simulate a local symbol.
Which one (vs with label) has a closer match as local symbol from original aobscan?
Will it work if the symbol is a registered-symbol defined before? (ie. cause error or redefine the registered-symbol)

_________________
- Retarded.
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: Sun Aug 02, 2015 2:51 am    Post subject: Reply with quote

ah yes, forgot about define
that'll work too

as for the difference, there's not much different after it has been defined (registersymbol doesn't work with defines though)

_________________
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
panraven
Grandmaster Cheater
Reputation: 55

Joined: 01 Oct 2008
Posts: 941

PostPosted: Sun Aug 02, 2015 5:10 am    Post subject: Reply with quote

It seems the define symbol override the registered symbol.

Thank you, it is working now.

It is an aa version of AOBScan with protect and address range, I'll post the code later.

bye~

_________________
- Retarded.
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