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 


LUA explanation

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

Joined: 10 Feb 2021
Posts: 1

PostPosted: Wed Feb 10, 2021 11:55 am    Post subject: LUA explanation Reply with quote

Hi, I'm new to LUA. I'm getting back into coding, with my experience being in QBASIC in middle school. I started learning C++, and I'm combining that knowledge to reverse games. I started making my first trainer for HL2, and I made stuff like the health, shield, and reserve ammo pointers easily.

Where I ran into trouble was with the clip ammo pointer, that seemed to break every time I restarted the game. So to give myself a little help I looked online to see if any cheat tables had figured out my issue. In the first table I downloaded I saw they solved my exact problem with a script:

[ENABLE]
"server.dll"+F0954:
db 90 90

[DISABLE]
"server.dll"+F0954:
db 89 1E

So what I was hoping to understand is, how does the db (function?) work?
I understand they found the static address, but what does the db line actually do? Any help is appreciated.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Wed Feb 10, 2021 12:18 pm    Post subject: Reply with quote

db, "define bytes", is a pseudoinstruction that writes bytes to an address. 0x90 is a nop instruction and 0x89 0x1e is a mov instruction. I'd use the full injection template and write it like this:
Code:
define(address,"server.dll"+F0954)
define(bytes,89 1E)
[ENABLE]
assert(address,bytes)

address:
  nop 2

[DISABLE]
address:
  db bytes

// big comment here indicating surrounding code to help find
// the injection point later in case server.dll gets updated

_________________
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
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8516
Location: 127.0.0.1

PostPosted: Wed Feb 10, 2021 1:25 pm    Post subject: Reply with quote

As a side note, what you posted is done using CEScript, not Lua.
CEScript is Cheat Engines custom script parser that interprets multiple things including:
- ASM
- Lua
- Custom CE-specific commands/features.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
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