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 


How to print register value whenever the instruction is bein

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

Joined: 04 Nov 2021
Posts: 1

PostPosted: Thu Nov 04, 2021 12:15 am    Post subject: How to print register value whenever the instruction is bein Reply with quote

[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(exit)

newmem:
mov [eax+00005578],ecx
????
....

code inject / How to print [eax] to console

I have just started learning CE so simple answers will be appreciated, thanks.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 102

Joined: 06 Jul 2014
Posts: 3182

PostPosted: Thu Nov 04, 2021 1:46 am    Post subject: Reply with quote

Maybe using "Find out what addresses this instruction accesses" in the right click menu of the disassembler would be better?

You could use the new {$luacode} feature.
https://forum.cheatengine.org/viewtopic.php?t=618134

_________________
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
LeFiXER
Grandmaster Cheater
Reputation: 5

Joined: 02 Sep 2011
Posts: 537
Location: 0x90

PostPosted: Thu Nov 04, 2021 1:52 am    Post subject: Reply with quote

You should use code tags when posting code.

(code)
... code here ...
(/code)

Note: replace parentheses "()" with square brackets "[]"

One way you can achieve this is like so:
Code:

[ENABLE]
...
alloc(newmem,2048)
alloc(registerToConsole,8) // use 4 if 32-bit

label(returnhere)
label(originalcode)
label(exit)

newmem:
mov [eax+00005578],ecx
mov [registerToConsole],eax

return:
// ...
{$LUA}
local eax = getAddressSafe('[registerToConsole]')
print(string.format("%X", eax))
{$ASM}
//...
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 422

Joined: 09 May 2003
Posts: 24042
Location: The netherlands

PostPosted: Thu Nov 04, 2021 5:25 am    Post subject: This post has 1 review(s) Reply with quote

Code:


[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(exit)

newmem:
mov [eax+00005578],ecx
{$luacode r1=eax r2=ecx}
printf("eax=%x ecx=%x address=%x", r1,r2,r1+0x5578)
{$asm}
...

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