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 


Help with changing specific bits in a value

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
Arcansel
Cheater
Reputation: 0

Joined: 04 Jun 2022
Posts: 28

PostPosted: Thu Aug 18, 2022 10:36 pm    Post subject: Help with changing specific bits in a value Reply with quote

I m trying to make a AA script to change only the last 3 bits while keeping the rest, the value is stored in 4 byte Big endian and i m viewing in Hex, FFFFF### i need to keep whatever is in those F and change only the #. If not possible, then a lua script but i dunno how to use Lua in a AA script altogether or even know how to use Lua at all, i really wanted it to be in just 1 script instead of having a separate one to assist the other.

Note: The value is actually 4 bits in size but the game only uses 3 bits, the max is 99 but it can go up to 999, crashing around 1030ish.

Thanks.


Last edited by Arcansel on Thu Aug 18, 2022 10:55 pm; edited 1 time in total
Back to top
View user's profile Send private message
sbryzl
Master Cheater
Reputation: 6

Joined: 25 Jul 2016
Posts: 252

PostPosted: Thu Aug 18, 2022 10:53 pm    Post subject: Reply with quote

Code:
newmem:
mov eax,[dwvalue]
and eax,fffff000
mov ecx,[nibble3]
and ecx,fff
or eax,ecx
mov [newval],eax
jmp return

dwvalue:
dd fffff555
nibble3:
dd abc
newval:
dd 0


If you need a different endian just flip the and values.
Back to top
View user's profile Send private message
Arcansel
Cheater
Reputation: 0

Joined: 04 Jun 2022
Posts: 28

PostPosted: Thu Aug 18, 2022 10:58 pm    Post subject: Reply with quote

sbryzl wrote:
Code:
newmem:
mov eax,[dwvalue]
and eax,fffff000
mov ecx,[nibble3]
and ecx,fff
or eax,ecx
mov [newval],eax
jmp return

dwvalue:
dd fffff555
nibble3:
dd abc
newval:
dd 0


Ty very much for the quick reply, i m gonna try it right now, hopefully with my limited knowledge i will be able to modify it for other games if needed.

Update:
Okay, i was gonna ask for more help in understanding the code but i managed to make it work myself, thanks again.
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