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 


Conditional if statement?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
SwaggaJackin'
Master Cheater
Reputation: 2

Joined: 06 Nov 2009
Posts: 304

PostPosted: Wed Jul 21, 2010 5:41 pm    Post subject: Conditional if statement? Reply with quote

I've been playing more and more with the auto assembler and I'm not too familiar with assembler in general but still learning.

I have an address that changes values according to the button being pressed. I want to change another address when a particular button is pressed and I'm not sure how to go about doing this in the auto assembler.

So basically, I want to monitor the value at address A and when address A holds a specific value, I want to change the value at address B.

I imagine it will be using a CMP and JE instruction. Just not sure how to piece it together. Thanks.

P.S. A hotkey will not be more efficient in this situation before someone suggests that.
Back to top
View user's profile Send private message
XaLeX
Expert Cheater
Reputation: 0

Joined: 19 Aug 2008
Posts: 226

PostPosted: Wed Jul 21, 2010 6:07 pm    Post subject: Reply with quote

If I understood,

C-like pseudocode:
Code:

int *A = read_address,
    *B = write_address;

if(*A == aSpecificValue)
    *B = something;


so, in ASM:
Code:

//eax is the address you're reading, ebx the one you're writing to
cmp [eax], aSpecificValue
jne after
mov [ebx],something
after:


the jne just skips the third line if the value is not the one you're looking for.
Back to top
View user's profile Send private message
Freiza
Grandmaster Cheater
Reputation: 22

Joined: 28 Jun 2010
Posts: 662

PostPosted: Fri Sep 17, 2010 3:56 pm    Post subject: Reply with quote

Go through these for better understanding

http://www.xs4all.nl/~smit/asm01001.htm
Back to top
View user's profile Send private message Send e-mail
Faxonation
Cheater
Reputation: 0

Joined: 18 Oct 2014
Posts: 25

PostPosted: Mon Sep 14, 2015 7:24 pm    Post subject: I have the same issue Reply with quote

I would like to know how to make this work

When this address 12B81548 has the value of 1,2,3,4 or 5

I want the value of these addresses



Address: Starting Value
11F9B8D4: 14642864 change to this value 4294967295
12882354: 24524640 change to this value 4294967295
129D2FA4: 25354864 change to this value 4294967295
129C7F14: 17747056 change to this value 4294967295
11F690D4: 25341312 change to this value 4294967295
12B297C4: 22708128 change to this value 4294967295
127599D4: 21844512 change to this value 4294967295
11FB04E4: 14799024 change to this value 4294967295
119C2784: 32426208 change to this value 4294967295
12A7C784: 26650400 change to this value 4294967295
1278A2A4: 25881776 change to this value 4294967295
12A8D634: 25287040 change to this value 4294967295
12840B34: 25000800 change to this value 4294967295
1277C1C4: 24423632 change to this value 4294967295
122D7E84: 23956064 change to this value 4294967295
127BFDC4: 22801696 change to this value 4294967295
12727EB4: 22557056 change to this value 4294967295
1194DFC4: 21479168 change to this value 4294967295
127B8C14: 17732800 change to this value 4294967295
1213EB44: 17081936 change to this value 4294967295
1280C0A4: 15161040 change to this value 4294967295
12894BE4: 14555504 change to this value 4294967295
122D7B94: 8755248 change to this value 4294967295

then when this address 12B8152C has a value of 0
Wait 2 seconds then values change back to the starting values

If anyone knows how to write this please let me know
Back to top
View user's profile Send private message
Snow1337
Catastrophic Cheatah
Reputation: 1

Joined: 12 Oct 2004
Posts: 183
Location: Your, Computer

PostPosted: Mon Sep 14, 2015 8:59 pm    Post subject: Re: I have the same issue Reply with quote

Faxonation wrote:
I would like to know how to make this work

When this address 12B81548 has the value of 1,2,3,4 or 5

I want the value of these addresses



Address: Starting Value
11F9B8D4: 14642864 change to this value 4294967295
12882354: 24524640 change to this value 4294967295
129D2FA4: 25354864 change to this value 4294967295
129C7F14: 17747056 change to this value 4294967295
11F690D4: 25341312 change to this value 4294967295
12B297C4: 22708128 change to this value 4294967295
127599D4: 21844512 change to this value 4294967295
11FB04E4: 14799024 change to this value 4294967295
119C2784: 32426208 change to this value 4294967295
12A7C784: 26650400 change to this value 4294967295
1278A2A4: 25881776 change to this value 4294967295
12A8D634: 25287040 change to this value 4294967295
12840B34: 25000800 change to this value 4294967295
1277C1C4: 24423632 change to this value 4294967295
122D7E84: 23956064 change to this value 4294967295
127BFDC4: 22801696 change to this value 4294967295
12727EB4: 22557056 change to this value 4294967295
1194DFC4: 21479168 change to this value 4294967295
127B8C14: 17732800 change to this value 4294967295
1213EB44: 17081936 change to this value 4294967295
1280C0A4: 15161040 change to this value 4294967295
12894BE4: 14555504 change to this value 4294967295
122D7B94: 8755248 change to this value 4294967295

then when this address 12B8152C has a value of 0
Wait 2 seconds then values change back to the starting values

If anyone knows how to write this please let me know


Code:
 [ENABLE] 
//code from here to '[DISABLE]' will be used to enable the cheat 

alloc(newmem,2048) //2kb should be enough 
label(returnhere) 
label(originalcode) 
label(changecode)
label(exit) 

Game.exe+12345678: 
jmp newmem 
returnhere: 
pop eax
newmem:
mov eax, [12B81548]
cmp eax, 01
je changecode
jne after
cmp eax, 02
je changecode
jne after
cmp eax, 03
je changecode
jne after
cmp eax, 04
je changecode
jne after
cmp eax, 05
je changecode
jne newmem
changecode:
mov esi, [11F9B8D4]
mov ebx, ff ff ff ff
mov esi, ebx
pop esi
mov esi, [12882354]
mov esi, ebx
pop esi
etc. etc.







originalcode: 
mov [esi+00000146],eax (guess)

exit: 
jmp returnhere 
  
  
[DISABLE] 
//code from here till the end of the code will be used to disable the cheat 
dealloc(newmem) //free memory 

Game.exe+12345678: 
[/code]
_________________
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 -> General Gamehacking 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