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 


[Q] Reading an address and writing its value to another (?)

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
Misteraaargh
Newbie cheater
Reputation: 0

Joined: 20 Dec 2012
Posts: 14

PostPosted: Sun Apr 07, 2013 10:33 pm    Post subject: [Q] Reading an address and writing its value to another (?) Reply with quote

Hi,

I have two memory addresses of a game ( Permanent pointers to both). What I want to do is to be able to make a script or something that -


1. Reads from address A

2. Does a simple arithmetic operation on the value A

3. Overwrites the value at address B with the result of arithmetic operation.

The idea is to be able to tie A and B together. 'something' read constantly from address A ( + arithematic on A) and keeps writing the value to address B. In case you should know it, A is the location of an object, and B is one of the pre-provided sliders relating to game-physics.

I have no prior programming experience, apart from writing hello world in at least ten languages Smile. I have basically two questions and would like them to be answered separately.

A) Is there any easy way to achieve this in cheat engine itself?

B) Are there certain languages that are more suited to memory manipulation than others? If yes, then what language would you suggest to a newbie to be able to start making simple scripts to read and write memory as quickly and easily as possible?

I may come up with ingenious ways to do it. As an example of ingenious - I once found a value for Z acceleration. I couldn't reach the actual gravity value for it after trying hard . So I set up -0.1 with a hotkey to Z-accel in CE. Then I downloaded an auto-key-clicker. And I set it to clicking the hotkey again and again. This resulted in creating a high gravity situation.

Though I love these kinds of problem solving ways, I would like to have your advice so that I do not have to create my own methods everytime to do simple memory manipulations..
Back to top
View user's profile Send private message
Mohsen
Advanced Cheater
Reputation: 1

Joined: 04 Apr 2013
Posts: 69
Location: PE

PostPosted: Mon Apr 08, 2013 1:58 am    Post subject: Reply with quote

A. If this is a AA code then no, otherwise you can read and write memory with cheat engine built in functions.
B. No

I assume the first address is 0xABC and the second 0xDEF

AA code:

Symbol mt is your calculated math with LUA.
Code:

push eax
push ebx
mov ebx, [mt]
mov eax, 0xDEF
mov [eax], ebx
pop ebx
pop eax

Cheat engine functions :
Code:

readBytes
writeBytes
readInteger
writeInteger

>> wiki.cheatengine.org/index.php?title=Lua
Back to top
View user's profile Send private message
Gniarf
Grandmaster Cheater Supreme
Reputation: 43

Joined: 12 Mar 2012
Posts: 1285

PostPosted: Mon Apr 08, 2013 2:02 am    Post subject: Re: [Q] Reading an address and writing its value to another Reply with quote

Misteraaargh wrote:
A) Is there any easy way to achieve this in cheat engine itself?
Yes, for example the following lua script:
Code:
addressA=0x20000;
addressB=0x20004;

if (MyTimer~=nil) then
   object_destroy(MyTimer);
   MyTimer=nil;
end

MyTimer = createTimer(nil,false)
timer_setInterval(MyTimer, 1000) --1000ms refresh time between calls of DoMyStuff
timer_onTimer(MyTimer, DoMyStuff)

function DoMyStuff(sender) --function that is executed every 1000ms
   local VariableA=readInteger(addressA)
   VariableA=VariableA+1; --do your maths here...
   writeInteger(0x20004,addressB);
end

if (TimerHotkey~=nil) then
   object_destroy(TimerHotkey);
   TimerHotkey=nil;
end

TimerHotkey=createHotkey(ToggleTimer, VK_F2); --when pressing F2 execute ToggleTimer
function ToggleTimer()
  if (MyTimer~=nil) then
     if (timer_getEnabled(MyTimer)) then
        timer_setEnabled(MyTimer, false)
     else
         timer_setEnabled(MyTimer, true)
     end
  end
end

Paste it in table->show table lua script, edit addressA & addressB, press execute, the press F2. Now every second the value at addressB will be equal to the one at addressA, incremented by 1.

That the simplest way to do your hack, but if you need addressB to be updated more often than every ~10ms, you'll have to use an injected auto assembler script instead.

Misteraaargh wrote:
B) Are there certain languages that are more suited to memory manipulation than others?.
Yes, x86 assembly when hacking, and C/C++ when making your programs. So is my opinion at least.
Misteraaargh wrote:
If yes, then what language would you suggest to a newbie to be able to start making simple scripts to read and write memory as quickly and easily as possible?
To a newbie, err...Well you WILL need assembly for any non-trivial hack, so try to learn that one, but at your pace since it's not a friendly language.
Lua, the language used in the script above is NOT meant for memory manipulation. Lua is mean to manipulate functions of an engine, be it a game engine or a cheat engine. And cheat engine is meant to manipulate memory...
I'm repeating myself, but consider that lua is a way to automate a lot of clicks in cheat engine, most of the time it's not vital/very useful for hacking.
Back to top
View user's profile Send private message
jucce
Advanced Cheater
Reputation: 1

Joined: 02 Apr 2013
Posts: 99

PostPosted: Mon Apr 08, 2013 2:15 pm    Post subject: Re: [Q] Reading an address and writing its value to another Reply with quote

Misteraaargh wrote:

B) Are there certain languages that are more suited to memory manipulation than others? If yes, then what language would you suggest to a newbie to be able to start making simple scripts to read and write memory as quickly and easily as possible?
I would suggest a language you already know fairly well. Personally I went with C# when I made a simple trainer previously. The reasons were that I knew the language since before, creating GUIs is relatively simple and there already exists classes for modifying memory that other people have made.
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