  | 
				
				Cheat Engine The Official Site of Cheat Engine   
				
 
				 | 
			 
		 
		 
	
		| View previous topic :: View next topic   | 
	 
	
	
		| Author | 
		Message | 
	 
	
		buyx86 Advanced Cheater
  Reputation: 0
  Joined: 10 May 2011 Posts: 82 Location: Philippines
  | 
		
			
				 Posted: Sat Mar 23, 2024 10:36 pm    Post subject: Merging two AOB scipts with the same signature | 
				       | 
			 
			
				
  | 
			 
			
				Can anybody teach me on how to merge two AOB scipts that uses the same signature? If I activate one, the other won't work and vice versa. This is in relation to the previous topic I posted: 
 
https://forum.cheatengine.org/viewtopic.php?t=622198
 
 
This is the code that I want to combine with it that has the same signature.
 
 	  | Code: | 	 		  [ENABLE]
 
aobscanmodule(MAX_LEVEL,Sys43VM.DLL,89 14 98 8B 81 10 02 00 00)
 
alloc(newmem,$1000)
 
 
alloc(enableMaxLevel,4)
 
 
label(codeMaxLevel)
 
label(returnMaxLevel)
 
 
registersymbol(enableMaxLevel)
 
 
enableMaxLevel:
 
  dd (int)0
 
 
newmem:
 
  cmp [enableMaxLevel],1
 
  jne codeMaxLevel
 
  cmp [eax+38],9
 
  jne codeMaxLevel
 
  cmp [eax+8],7D1
 
  je codeMaxLevel
 
  mov [eax+E4],63
 
  jmp codeMaxLevel
 
 
codeMaxLevel:
 
  mov [eax+ebx*4],edx
 
  mov eax,[ecx+00000210]
 
  jmp returnMaxLevel
 
 
MAX_LEVEL:
 
  jmp newmem
 
  nop 4
 
 
returnMaxLevel:
 
registersymbol(MAX_LEVEL)
 
 
 
[DISABLE]
 
MAX_LEVEL:
 
  db 89 14 98 8B 81 10 02 00 00
 
 
unregistersymbol(enableMaxLevel)
 
unregistersymbol(MAX_LEVEL)
 
 
dealloc(newmem)
 
dealloc(enableMaxLevel) | 	  
 | 
			 
		  | 
	 
	
		| Back to top | 
		 | 
	 
	
		  | 
	 
	
		ParkourPenguin I post too much
  Reputation: 152
  Joined: 06 Jul 2014 Posts: 4706
 
  | 
		
			
				 Posted: Sat Mar 23, 2024 10:50 pm    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				One common way is to use flags to determine whether or not some code is run.
 
 
 	  | Code: | 	 		  ...
 
 
alloc(script1flag,4)
 
alloc(script2flag,4)
 
 
script1flag:
 
  dd 0
 
script2flag:
 
  dd 0
 
 
newmem:
 
  cmp [script1flag],0
 
  jz checkScript2
 
  
 
  // script 1 code here
 
 
checkScript2:
 
  cmp [script2flag],0
 
  jz originalCode
 
 
  // script 2 code here
 
 
originalCode:
 
  
 
  // original code
 
 
  jmp return
 
 
...
 
 
registersymbol(script1flag)
 
registersymbol(script2flag)
 
 
... | 	  For the flags, add 2 new memory records, addresses are script1flag & script2flag, click + drag them onto the injection script, right click the script, and select Group config -> Hide children when deactivated.
 
Maybe set dropdown selection options on the 2 flag memory records too. Right click -> Set/Change dropdown selection options. Something like "0:Disabled" / "1:Enabled".
 
 
Instead of address memory records, you could make them scripts instead like this:
 
 	  | Code: | 	 		  [ENABLE]
 
script1flag:
 
  dd 1
 
 
[DISABLE]
 
script1flag:
 
  dd 0 | 	  Hide them under the parent script same as before.
 _________________
 I don't know where I'm going, but I'll figure it out when I get there.  | 
			 
		  | 
	 
	
		| Back to top | 
		 | 
	 
	
		  | 
	 
	
		buyx86 Advanced Cheater
  Reputation: 0
  Joined: 10 May 2011 Posts: 82 Location: Philippines
  | 
		
			
				 Posted: Sun Mar 24, 2024 1:18 am    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				Yes, it works! Thank you very much. This is how my code turned out.
 
 	  | Code: | 	 		  
 
[ENABLE]
 
aobscanmodule(SET1,Sys43VM.DLL,89 14 98 8B 81 10 02 00 00)
 
alloc(newmem1,$1000)
 
 
alloc(enableMaxLevel,4)
 
alloc(enableGodMode,4)
 
 
label(checkGodMode)
 
label(moves)
 
label(solo_hp)
 
label(codeSET1)
 
label(returnSET1)
 
 
enableMaxLevel:
 
  dd 0
 
enableGodMode:
 
  dd 0
 
 
newmem1:
 
  cmp [enableMaxLevel],0
 
  jz checkGodMode
 
  cmp [eax+38],9
 
  jne checkGodMode
 
  cmp [eax+8],7D1
 
  je checkGodMode
 
  mov [eax+E4],63
 
 
checkGodMode:
 
  cmp [enableGodMode],0
 
  jz codeSET1
 
  cmp [eax+10C],1
 
  jne codeSET1
 
  cmp [eax+F0],1
 
  jne codeSET1
 
  cmp ebx,15
 
  jne moves
 
  push edx
 
  mov edx,[eax+58]
 
  mov [eax+ebx*4],edx
 
  pop edx
 
  mov eax,[ecx+00000210]
 
  jmp returnSET1
 
 
moves:
 
  cmp ebx,1E
 
  jne solo_hp
 
  push edx
 
  mov edx,[eax+7C]
 
  mov [eax+ebx*4],edx
 
  pop edx
 
  mov eax,[ecx+00000210]
 
  jmp returnSET1
 
 
solo_hp:
 
  cmp ebx,36
 
  jne codeSET1
 
  push edx
 
  mov edx,[eax+DC]
 
  mov [eax+ebx*4],edx
 
  pop edx
 
  mov eax,[ecx+00000210]
 
  jmp returnSET1
 
 
codeSET1:
 
  mov [eax+ebx*4],edx
 
  mov eax,[ecx+00000210]
 
  jmp returnSET1
 
 
SET1:
 
  jmp newmem1
 
  nop 4
 
 
returnSET1:
 
registersymbol(SET1)
 
 
registersymbol(enableMaxLevel)
 
registersymbol(enableGodMode)
 
 
[DISABLE]
 
SET1:
 
  db 89 14 98 8B 81 10 02 00 00
 
 
unregistersymbol(enableMaxLevel)
 
unregistersymbol(enableGodMode)
 
unregistersymbol(SET1)
 
 
dealloc(newmem1)
 
dealloc(enableMaxLevel)
 
dealloc(enableGodMode)
 
 | 	  
 
 
And this is how my scripts to activate the codes look like.
 
 	  | Code: | 	 		  
 
[ENABLE]
 
{$LUA}
 
writeInteger("enableGodMode",1)
 
{$ASM}
 
 
 
[DISABLE]
 
{$LUA}
 
writeInteger("enableGodMode",0)
 
{$ASM}
 
 | 	  
 
 
All I need to do now is learn how to create a loop that would repeat a code into the script.
 | 
			 
		  | 
	 
	
		| Back to top | 
		 | 
	 
	
		  | 
	 
	
		 | 
	 
 
  
	 
	    
	   | 
	
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
  | 
   
 
		 |