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 


define AA labels with lua (inside the same script)

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

Joined: 17 Mar 2016
Posts: 42

PostPosted: Wed Aug 11, 2021 5:48 am    Post subject: define AA labels with lua (inside the same script) Reply with quote

Is it possible to define a AA label inside the {$lua} part of the script?
Example:
Code:

[ENABLE]

//aobscanmodule(INJECT,Tutorial-x86_64.exe,81 BB F0 07 00 00 E8 03 00 00)
//alloc(newmem,$1000,INJECT)


{$lua}

if syntaxcheck then return end
INJECT = AOBScan("81 BB F0 07 00 00 E8 03 00 00 75 ?? 48 8B 8B C0 07 00 00")

newmem = allocateMemory(1000,INJECT)

{$asm}

label(code)
label(return)

newmem:

code:
  cmp [rbx+000007F0],000003E8
  jmp return

INJECT:
  jmp newmem
  nop 5
return:
registersymbol(INJECT)

[DISABLE]

INJECT:
  db 81 BB F0 07 00 00 E8 03 00 00

unregistersymbol(INJECT)
dealloc(newmem)

So in this script i want to reference the INJECT and newmem lua variables as AA labels, is that possible?
I know I can register symbols with lua and reference them that way, but those symbols are then global, is there something similar that's local to the script?
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: Wed Aug 11, 2021 5:59 am    Post subject: Reply with quote

before {$asm} add the line:
Code:

return string.format('define(newmem,%x)',newmem)


you may also want to adjust the dealloc in disable and replace it with a lua block (You'll have to keep track of the address of newmem yourself)

_________________
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
Skyrimfus
Cheater
Reputation: 1

Joined: 17 Mar 2016
Posts: 42

PostPosted: Wed Aug 11, 2021 6:01 am    Post subject: Reply with quote

ah ofcourse, I had completely forgot that whatever string you return it gets "pasted" into the script. Thanks!
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