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 change one cheat entry based on another?

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

Joined: 08 May 2016
Posts: 3

PostPosted: Fri Mar 22, 2019 7:07 pm    Post subject: How to change one cheat entry based on another? Reply with quote

So I have a cheat entry as a byte, and I want it to change to a specific value, dependent on the value of another byte cheat entry.

For example;

If A = 01 then B = 05
If A = 02 then B = 06
end

What the easiest way to achieve this with scripting and ensure it updates as the gam runs? thanks
Back to top
View user's profile Send private message
OldCheatEngineUser
Whateven rank
Reputation: 20

Joined: 01 Feb 2016
Posts: 1586

PostPosted: Fri Mar 22, 2019 7:41 pm    Post subject: Reply with quote

can A go higher than 2? can A go lower than 1?

or do you want B to be whatever in A+4?

are A and B pointers? registered symbol? memory-location referenced by an instruction?

_________________
About Me;
I Use CE Since Version 1.X, And Still Learning How To Use It Well!
Jul 26, 2020
STN wrote:
i am a sweetheart.
Back to top
View user's profile Send private message Visit poster's website
feure
How do I cheat?
Reputation: 0

Joined: 08 May 2016
Posts: 3

PostPosted: Fri Mar 22, 2019 7:49 pm    Post subject: Reply with quote

A and B can go from 00 to FF.

+4 is just an arbitrary example - want to be able to specify according to needs .

A and B are values in an address offset from a pointer.
Back to top
View user's profile Send private message
OldCheatEngineUser
Whateven rank
Reputation: 20

Joined: 01 Feb 2016
Posts: 1586

PostPosted: Fri Mar 22, 2019 8:38 pm    Post subject: Reply with quote

it will be more efficient to use lua in this case, unless you are hooking the instruction then assembly is the choice.

since i cant write a single line in lua, i will do it in assembly.

the spawned thread will never return, and it might cause a crash upon disabling the script. (unless you specify a termination condition)



Code:
[enable]

alloc(newmem,$100)
createthread(newmem)

newmem:
lea esi,[[[[[["gamename.exe"+XXXXX]+offset1]+offset2]+offset3]+offset4]+offset5] // A // replace me (pointer)
lea edi,[[[[[["gamename.exe"+XXXXX]+offset1]+offset2]+offset3]+offset4]+offset5] // B // replace me (pointer)
mov al,byte [edi]
mov dl,byte [esi]
jmp short B_equal_A_plus_4 // jump where you want

B_plus_4: // B = B +4
add al,4
adc al,0
mov byte [edi],al
jmp short newmem

B_equal_A_plus_4: // B = A+4
add dl,4
adc dl,0
mov byte [edi],dl
jmp short newmem

[disable]
dealloc(newmem)

_________________
About Me;
I Use CE Since Version 1.X, And Still Learning How To Use It Well!
Jul 26, 2020
STN wrote:
i am a sweetheart.
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 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