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 


set value to another address value

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

Joined: 14 Feb 2021
Posts: 2

PostPosted: Sun Feb 14, 2021 10:55 am    Post subject: set value to another address value Reply with quote

I've been looking at tutorial and searching for what I want to do with no success.

so basically I want address x value to be constantly set to address y value.

Can anyone help me do that?
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4704

PostPosted: Sun Feb 14, 2021 11:37 am    Post subject: Reply with quote

Add them both to the address list, freeze address x, and set the value of address x to (description of address y) - parenthesis included.
_________________
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
enkisama
How do I cheat?
Reputation: 0

Joined: 14 Feb 2021
Posts: 2

PostPosted: Sun Feb 14, 2021 11:40 am    Post subject: Reply with quote

Well that was easy.

Thanks a lot
Back to top
View user's profile Send private message
Fatamorgen
Cheater
Reputation: 0

Joined: 17 Feb 2021
Posts: 29

PostPosted: Wed Feb 17, 2021 9:03 pm    Post subject: Reply with quote

ParkourPenguin wrote:
Add them both to the address list, freeze address x, and set the value of address x to (description of address y) - parenthesis included.


Hello.

This works like the readmem, right mate?

Code:
00000000:
readmem(00000001,2)


Is there a way to "freeze" the readmem to constantly copy from one address to another? I mean if I'm to use script (code injection) instead of the direct address available on the list or lua scripting. The easiest way I found to do this is by using lua since I'm familiar to the program language but I would like to know if it's possible to do the same using code injection, because every time I enable the code it will copy only once and then stop.

Sorry to take your time, but I don't know much about the code injection since I'm new to cheat engine. Also I'm reading the information in the wiki, but it will take some time for me to absorb all the info. Very Happy
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4704

PostPosted: Thu Feb 18, 2021 1:13 am    Post subject: Reply with quote

Lua would probably be easiest.
Code:
{$lua}
if syntaxcheck then return end
if not mySpecialTimer then
  -- initialize timer
  mySpecialTimer = createTimer()
  mySpecialTimer.OnTimer = function()
    writeInteger(address,value)
  end
  mySpecialTimer.Interval = 1000
end
[ENABLE]
mySpecialTimer.Enabled = true
[DISABLE]
mySpecialTimer.Enabled = false


You can also use AA by injecting code at instructions that write to the value. Far more reliable since the game can't see any other value other than the one you want, but this requires knowledge of assembly.
Code:
...
newmem:
  // my code
  mov ecx,C8
  // original code
  mov [rdi+20],ecx
...

_________________
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
Fatamorgen
Cheater
Reputation: 0

Joined: 17 Feb 2021
Posts: 29

PostPosted: Thu Feb 18, 2021 9:00 am    Post subject: Reply with quote

ParkourPenguin wrote:
Lua would probably be easiest.
Code:
{$lua}
if syntaxcheck then return end
if not mySpecialTimer then
  -- initialize timer
  mySpecialTimer = createTimer()
  mySpecialTimer.OnTimer = function()
    writeInteger(address,value)
  end
  mySpecialTimer.Interval = 1000
end
[ENABLE]
mySpecialTimer.Enabled = true
[DISABLE]
mySpecialTimer.Enabled = false


You can also use AA by injecting code at instructions that write to the value. Far more reliable since the game can't see any other value other than the one you want, but this requires knowledge of assembly.
Code:
...
newmem:
  // my code
  mov ecx,C8
  // original code
  mov [rdi+20],ecx
...


Hello and good morning Very Happy
You're absolutely right about lua since is a light programing language (imho).

When using code injection: Do you know if I can put readmen within newmem without crashing the game?

eg.

Code:
newmem:
15903821:
readmem(16760161,2)
mov [rdi+20],ecx  //originalcode to avoid crash


The original instruction or code at the end of line is only there to avoid crash, but it doesn't work Sad . What I'm doing wrong here?

Also, is there a way to use a comparator to copy values from one mem to another?

Thanks for the last answer.
Back to top
View user's profile Send private message
sbryzl
Master Cheater
Reputation: 6

Joined: 25 Jul 2016
Posts: 252

PostPosted: Thu Feb 18, 2021 10:42 am    Post subject: Reply with quote

If you're going to do code injection start with a template (aob or full injection template). Then you will have something to work with.

Putting an address label directly under newmem isn't a good idea. Under newmem you want to put code or data. If you change the address location under newmem it's basically just saying to ignore the newmem address.
Back to top
View user's profile Send private message
Fatamorgen
Cheater
Reputation: 0

Joined: 17 Feb 2021
Posts: 29

PostPosted: Thu Feb 18, 2021 11:31 am    Post subject: Reply with quote

sbryzl wrote:
If you're going to do code injection start with a template (aob or full injection template). Then you will have something to work with.

Putting an address label directly under newmem isn't a good idea. Under newmem you want to put code or data. If you change the address location under newmem it's basically just saying to ignore the newmem address.


Good afternoon.
You're absolutely right, mate. I did something similar, I used full injection.
What I want to know if is there a way to use comparators (cmp) to analise one address value and then copy this value constantly into another address value.

Eg.
If addressX = 100 then
addressY = 100
If ..... = 99 then
..... = 99

AddressX set the same value to AddressY. If one changes so the other.

Exactly like the readmem procedure but unfortunately readmem copy only once and then stops. Through lua I already managed to do this by simply using read and write instructions, but since I'm learning to use code injection I was looking for some experienced cheaters to help me with that.

Thanks for the tip about aob.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4704

PostPosted: Thu Feb 18, 2021 11:39 am    Post subject: Reply with quote

I'm assuming newmem is allocated memory.
Code:
alloc(newmem,2048)


Instructions (including pseudoinstructions such as readmem) are written sequentially to the address last specified in the script.
Code:
foo:
  mov ecx,[edx+10]
  cmp [edi+2C],ecx
  cmovge [edi+30],ecx
  reassemble(INJECT)
  jmp return
In this example, the mov, cmp, cmovge, reassemble, and jmp (pseudo)instructions are written sequentially starting at the address foo.

In your example:
Code:
newmem:
15903821:
readmem(16760161,2)
mov [rdi+20],ecx
newmem specifies an address to write data to, but you don't specify anything to write. Instead, you immediately specify another address, 15903821, which the readmem and mov (pseudo)instructions are sequentially written to.

If you want the game to write a value when the code is run, you'll have to write the code.
Code:
newmem:
  push rax
  mov ax,[16760161]
  mov [15903821],ax
  pop rax
  mov [rdi+20],ecx  // assuming rdi+20 doesn't alias either previous access
  jmp return

Also, there's more to that injection point. "mov [rdi+20],ecx" is only 3 bytes- you need at least 2 more for a jump to your code.

Go through the CE tutorial if you haven't already done so.

_________________
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
Fatamorgen
Cheater
Reputation: 0

Joined: 17 Feb 2021
Posts: 29

PostPosted: Thu Feb 18, 2021 12:11 pm    Post subject: Reply with quote

I see. It looks harder than lua.
I'll try that, mate. Thank you, Mr. Penguin and sbryzl, may both have a good day. Very Happy
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