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 


[Solved] CE Scripting - Toggling "Boolean" Values

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

Joined: 01 Jul 2018
Posts: 29

PostPosted: Sun Apr 05, 2020 10:20 pm    Post subject: [Solved] CE Scripting - Toggling "Boolean" Values Reply with quote

What would be an effective way to script the change of a value from 0 to 1 and vice versa? I'm hacking Doom2 in dosbox, an emulator. Maybe I'm on the wrong path and need some sort of code injection, but here's what I have so far:

Code:
[enable]
globalalloc(mem, $32)

define(useShotGunAddress, [basep]+1cdf00)
registersymbol(useShotGunAddress)

//change useShotGunAddress value to 1

[disable]

//change useShotGunAddress to 0

dealloc(mem)

unregistersymbol(useShotGunAddress)


Thank you kindly in advance.

[Edit]

See below for solution.

_________________
Big Gun
#1
Shoot the Hell Outta You


Last edited by Menoetius on Sun Apr 05, 2020 11:55 pm; edited 1 time in total
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4719

PostPosted: Sun Apr 05, 2020 11:30 pm    Post subject: Reply with quote

Code:
[ENABLE]
[basep]+1cdf00:
  db 1

[DISABLE]
[basep]+1cdf00:
  db 0

If for whatever reason that syntax doesn't work:
Code:
{$lua}
[ENABLE]
writeBytes('[basep]+1cdf00', 1)

[DISABLE]
writeBytes('[basep]+1cdf00', 0)

Alternatively, look into dropdown options for memory records. Just add a memory record with base address "basep" and L1 offset 1cdf00, and set dropdown options in the right click menu.

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

Joined: 01 Jul 2018
Posts: 29

PostPosted: Sun Apr 05, 2020 11:55 pm    Post subject: Reply with quote

Perfect. Exactly What I was looking for and both solutions work nicely.

Thank you again.

_________________
Big Gun
#1
Shoot the Hell Outta You
Back to top
View user's profile Send private message
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