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 


Using code under Disable section of AA script

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

Joined: 22 Dec 2011
Posts: 51

PostPosted: Mon May 08, 2017 4:02 am    Post subject: Using code under Disable section of AA script Reply with quote

Hi,

I am wondering if it's possible to write a piece of code under the disable section. Basically, when the script is disabled I want it to modify a value. Below is the table I'd like to try and make work.

Code:
[ENABLE]

aobscan(testscript,58 48 8B 83 F0 00 00 00 0F 28 90 A0 01 00 00)
alloc(newmem,$1000)

label(code)
label(return)
label(endcode)

newmem:
cmp [rax+000000AC],0
je code
mov [rax+000001A0],(float)-10000


code:
  movaps xmm2,[rax+000001A0]
  jmp return

testscript+08:
  jmp newmem
  nop
  nop
return:
registersymbol(testscript)

[DISABLE]
cmp [rax+000000AC],0
je endcode
mov [rax+000001A0],(float)-6000

endcode:
testscript+08:
  db 0F 28 90 A0 01 00 00

unregistersymbol(testscript)
dealloc(newmem)


So basically, while the script is active, [rax+1a0] will be set to "(float)-10000" if [rax+ac] is not 0. When the script is disabled, I want to modify [rax+1a0] to "(float)-6000" if [rax+ac] is not 0. Is this possible?

With the current script, the endcode label is not recognized. I tried moving that label under the disable section and it enabled successfully. However the script will not disable unless I remove the section I'm trying to make work.
Back to top
View user's profile Send private message
FreeER
Master Cheater
Reputation: 13

Joined: 09 Aug 2013
Posts: 363

PostPosted: Mon May 08, 2017 6:26 am    Post subject: This post has 1 review(s) Reply with quote

I'd say change the code a bit then you can have two scripts, one to change the code to something like this:

Code:
[ENABLE]
aobscan(testscript,58 48 8B 83 F0 00 00 00 0F 28 90 A0 01 00 00)
alloc(newmem,$1000)

label(code)
label(return)
label(endcode)
label(scriptNameEnabled)

newmem:
cmp [rax+000000AC],0
je code

cmp byte ptr [enabled], 0
je @f
mov [rax+000001A0],(float)-10000
jmp code
@@: // anonymous label
mov [rax+000001A0],(float)-6000

code:
  movaps xmm2,[rax+000001A0]
  jmp return

scriptNameEnabled:
  db 0 // false

testscript+08:
  jmp newmem
  nop
  nop
return:
registersymbol(testscript)
registersymbol(scriptNameEnabled)

[DISABLE]
testscript+08:
  db 0F 28 90 A0 01 00 00
dealloc(newmem)
unregistersymbol(testscript)
unregistersymbol(scriptNameEnabled)


and the other would toggle which value is moved. Or you could just have two separate scripts, on that moved -10000 and one that moved -6000...

Code:
[ENABLE]
scriptNameEnabled:
  db 1 // true
[DISABLE]
scriptNameEnabled:
  db 0 // false


Though at that point you could do something like this:

Code:
[ENABLE]
aobscan(testscript,58 48 8B 83 F0 00 00 00 0F 28 90 A0 01 00 00)
alloc(newmem,$1000)

label(code)
label(return)
label(endcode)
label(scriptNameValue)

newmem:
cmp [rax+000000AC],0
je code
push rbx
mov rbx, dword ptr [scriptNameValue]
mov [rax+1a0], rbx
pop rbx

code:
  movaps xmm2,[rax+000001A0]
  jmp return

scriptNameValue:
  dd (float)-10000

testscript+08:
  jmp newmem
  nop
  nop
return:
registersymbol(testscript)
registersymbol(scriptNameValue)

[DISABLE]
testscript+08:
  db 0F 28 90 A0 01 00 00
dealloc(newmem)
unregistersymbol(testscript)
unregistersymbol(scriptNameValue)


and then you could add a value with scriptNameValue as the address and the user can change what value is set by changing that value in the address list.

There may be other ways to do it but those are the most obvious to me.
Back to top
View user's profile Send private message
Classicus
Advanced Cheater
Reputation: 0

Joined: 22 Dec 2011
Posts: 51

PostPosted: Mon May 08, 2017 7:37 pm    Post subject: Reply with quote

Thanks for the suggestions FreeER! I suppose that will do the job.
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