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 


Assigning a value once script is disabled?

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

Joined: 02 Sep 2018
Posts: 44
Location: Rhode Island, USA

PostPosted: Mon Mar 11, 2024 10:26 pm    Post subject: Assigning a value once script is disabled? Reply with quote

I am trying to have my script set my value to '00' when the script is disabled, but my way isn't working (Although the value does change like it should when the script is enabled) - I'm assuming I just missed something simple, and was hoping someone in here could point out whatever I messed up - Thank you in advance!

Code:

[ENABLE]

aobscanmodule(cat,Siralim.exe,44 38 40 10 74 57)
alloc(newmem,$100,cat)
alloc(off,4)
registersymbol(off)
label(code)
label(return)

newmem:
  mov [rax+10],01 <--- Value this script changes (Works correctly)

code:
  cmp [rax+10],r8b
  je Siralim.exe+49DACF
  jmp return

cat:
  jmp newmem
  nop
return:
registersymbol(cat)

[DISABLE]

off:
  mov [rax+10],00 <-- Trying to set the value once script is disabled here

cat:
  db 44 38 40 10 74 57

unregistersymbol(cat)
dealloc(newmem)
dealloc(off)
unregistersymbol(off)

_________________
.: Cheat Engine N00b in Progress :.

I'll earn my avatar someday ...
Back to top
View user's profile Send private message
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1055
Location: 0x90

PostPosted: Mon Mar 11, 2024 11:09 pm    Post subject: Reply with quote

You'll want to tackle this a different way, using a flag:
Code:

[ENABLE]
aobscanmodule(cat,Siralim.exe,44 38 40 10 74 57)
alloc(newmem,$1000,cat)

label(code)
label(return)
label(toggle)

newmem:
  cmp byte ptr [toggle],0
  je @f
  mov [rax+10],01 <--- Value this script changes (Works correctly)
  jmp code

// Toggle is disabled so we set the value to 0
@@:
  mov [rax+10],0
  jmp code

toggle:
  db 0

code:
  cmp [rax+10],r8b
  je Siralim.exe+49DACF
  jmp return

cat:
  jmp newmem
  nop
return:
registersymbol(cat)
registersymbol(toggle)
[DISABLE]

cat:
  db 44 38 40 10 74 57

unregistersymbol(cat)
unregistersymbol(toggle)
dealloc(newmem)


Add a new script with the following code:
Code:

[ENABLE]
toggle:
  db 1

[DISABLE]
toggle:
  db 0
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4307

PostPosted: Mon Mar 11, 2024 11:49 pm    Post subject: Reply with quote

AA scripts change code the game executes. Key point being it's the game that executes the code- not CE.

In other words, just because you write down instructions doesn't mean they'll get executed after you enable the script. The game must run the instructions in order for them to do anything.

You could copy the address and write to that address (if it exists) in the disable section.
Code:
[ENABLE]
aobscanmodule(cat,Siralim.exe,44 38 40 10 74 57)
alloc(newmem,$100,cat)
alloc(mySpecialAddress,8)
label(return)

newmem:
  mov [mySpecialAddress],rax
  mov [rax+10],1
  cmp [rax+10],r8b
  je Siralim.exe+49DACF
  jmp return

cat:
  jmp newmem
  nop
return:

mySpecialAddress:
  dq 0

registersymbol(cat)
registersymbol(mySpecialAddress)

[DISABLE]
{$lua}
if syntaxcheck then return end

local addr = readInteger'[mySpecialAddress]+10'

if not addr then return end

writeInteger(addr, 0)
{$asm}

cat:
  db 44 38 40 10 74 57

dealloc(newmem)
dealloc(mySpecialAddress)
unregistersymbol(cat)
unregistersymbol(mySpecialAddress)

_________________
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
relentlesstech
Cheater
Reputation: 1

Joined: 02 Sep 2018
Posts: 44
Location: Rhode Island, USA

PostPosted: Tue Mar 12, 2024 10:43 am    Post subject: Reply with quote

Thank you for the replies! Once I get home from work I'll give it another shot
_________________
.: Cheat Engine N00b in Progress :.

I'll earn my avatar someday ...
Back to top
View user's profile Send private message
relentlesstech
Cheater
Reputation: 1

Joined: 02 Sep 2018
Posts: 44
Location: Rhode Island, USA

PostPosted: Tue Mar 12, 2024 8:19 pm    Post subject: Reply with quote

LeFiXER wrote:
You'll want to tackle this a different way, using a flag:
Code:

[ENABLE]
aobscanmodule(cat,Siralim.exe,44 38 40 10 74 57)
alloc(newmem,$1000,cat)

label(code)
label(return)
label(toggle)

newmem:
  cmp byte ptr [toggle],0
  je @f
  mov [rax+10],01 <--- Value this script changes (Works correctly)
  jmp code

// Toggle is disabled so we set the value to 0
@@:
  mov [rax+10],0
  jmp code

toggle:
  db 0

code:
  cmp [rax+10],r8b
  je Siralim.exe+49DACF
  jmp return

cat:
  jmp newmem
  nop
return:
registersymbol(cat)
registersymbol(toggle)
[DISABLE]

cat:
  db 44 38 40 10 74 57

unregistersymbol(cat)
unregistersymbol(toggle)
dealloc(newmem)


Add a new script with the following code:
Code:

[ENABLE]
toggle:
  db 1

[DISABLE]
toggle:
  db 0


This worked great! Thank you again!
I did forget that in order to change the value back and forth I needed to have the sub-script to actually toggle the value from one to another - I still have much to learn!

_________________
.: Cheat Engine N00b in Progress :.

I'll earn my avatar someday ...
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