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 


Any way to determine values of registers through scripting?

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

Joined: 11 Jul 2023
Posts: 2

PostPosted: Tue Jul 11, 2023 3:39 pm    Post subject: Any way to determine values of registers through scripting? Reply with quote

Hello all! Sorry if this question has been asked before, but I haven't found an explanation anywhere, and I have come to you for your help.

I have found an opcode that subtracts from player health. Cool, right? Looks something like this:
Code:
sub [edx+00000408],eax

wherein edx+408 is the health address, and eax is probably the enemy damage calculated somewhere above (I don't really care about that)

My question is: instead of generating pointermaps and pointerscanning like I have done already, is there any way to just get the value of edx at this opcode via scripting, to then be able to incorporate it into my cheat table? (And set values for this health)

Thank you all.

_________________
"An idiot admires complexity, a genius admires simplicity, a physicist tries to make it simple, for an idiot anything the more complicated it is the more he will admire it." - Terry Davis
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 468

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

PostPosted: Tue Jul 11, 2023 3:53 pm    Post subject: Reply with quote

yes

do a code injection at that spot, allocate some memory for the storage of the register , register the symbol, and then your script can reference that address you allocated as a pointer

Code:

alloc(script,512)
alloc(edxvalue,4)
registersymbol(edxvalue)

script:
mov [edxvalue],edx

originalcode:
sub [edx+00000408],eax
jmp returnhere

12345678:
jmp script
db 0

returnhere:



and then you can use a pointer with base address name "edxvalue" and offset 408

_________________
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
Scooss
How do I cheat?
Reputation: 0

Joined: 11 Jul 2023
Posts: 2

PostPosted: Tue Jul 11, 2023 5:37 pm    Post subject: Reply with quote

For some reason doing this NEVER works for me. Here is my script so you can tell me about any errors;
Code:

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

alloc(mymem,4)
registersymbol(mymem)

newmem: //this is allocated memory, you have read,write,execute access
//place your code here

add [edx+00000408],eax
mov [mymem],edx
jmp exit

originalcode:
sub [edx+00000408],eax

exit:
jmp returnhere

Terraria.Player::Hurt+1201:
jmp newmem
nop
returnhere:


 
 
[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)
dealloc(mymem)
unregistersymbol(mymem)
Terraria.Player::Hurt+1201:
db 29 82 08 04 00 00
//sub [edx+00000408],eax


Adding "mymem+408" into the address bar manually NEVER gives me the health address, no matter what I try. (Yes, I did enable the script before doing so, so the symbol did actually register)

Any tips? I'm so lost...

_________________
"An idiot admires complexity, a genius admires simplicity, a physicist tries to make it simple, for an idiot anything the more complicated it is the more he will admire it." - Terry Davis
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 150

Joined: 06 Jul 2014
Posts: 4652

PostPosted: Tue Jul 11, 2023 10:42 pm    Post subject: Reply with quote

Scooss wrote:
Adding "mymem+408" into the address bar
Use a pointer. DB already explained it:
Dark Byte wrote:
you can use a pointer with base address name "edxvalue" and offset 408
More specifically, check the "pointer" checkbox, use the registered symbol as the base address, and the only offset should be 408.

Also, the code has to run in order for it to do anything. I don't mean that you have to enable the script: that just changes the code. I mean the game must run the code that you changed. Given the function is named `Terraria.Player::Hurt`, I figure the player has to take damage.

_________________
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
HalfWolf
Newbie cheater
Reputation: 0

Joined: 03 Jan 2023
Posts: 12

PostPosted: Mon Jul 17, 2023 10:28 pm    Post subject: Reply with quote

Typically, opcode manipulation and value retrieval require a deeper understanding of assembly language and memory management. This often involves analyzing the disassembled code, locating relevant memory addresses, and applying appropriate techniques to extract or modify values.

While scripting can be a useful tool in automating certain processes or interacting with the game, accessing specific register values like edx at runtime might not be directly achievable through scripting alone.

If you're interested in exploring further, I would suggest delving into assembly language and memory manipulation techniques. This will allow you to gain a better understanding of the inner workings of the game and enable you to create more advanced cheats or modifications.
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 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