| View previous topic :: View next topic   | 
	
	
	
		| Author | 
		Message | 
	
	
		Dark Byte Site Admin
  Reputation: 470
  Joined: 09 May 2003 Posts: 25807 Location: The netherlands
  | 
		
			
				 Posted: Sun Feb 13, 2011 6:34 am    Post subject: Using an aobscan with multiple results | 
				       | 
			 
			
				
  | 
			 
			
				The Lua version of aobScan returns all the addresses with the specified bytes instead of only the first one like auto assembler does
 
 
If you know that the one you need is the second or third and not the first then this script might be useful  (Of course, i still recommend just adding a few more bytes to your array of bytes string)
 
 
 	  | Code: | 	 		  
 
function _memrec_myCheat_activating(mr)
 
  results=AOBScan("29 83")
 
  if (results~=nil) then
 
    count=stringlist_getCount(results)
 
    if (count>1) then
 
      address=stringlist_getString(results,1) --counts from 0, so 0 = first, 1=second, etc...
 
      --seems I forgot to add a registersymbol command so use AA for this
 
      script=[[
 
        label(aobresult_myCheat)  
 
        registersymbol(aobresult_myCheat)
 
        ]]..address..[[:
 
        aobresult_myCheat:
 
        ]]   
 
      autoAssemble(script);
 
    end
 
    object_destroy(results)
 
    results=nil
 
  end
 
end
 
 | 	  
 
 
This registers an onActive event for a cheat table with the name "myCheat"
 
when myCheat gets activated this function gets executed which does the Lua version AOBscan , gets the second entry of the results and then registers that result as a symbol.
 
After that the cheat entry can then make use of it. (Auto assembler script that hooks a function for example)
 
 
I've attached an example cheat table that implements this. (For the tutorial that comes with ce)
 _________________
 Do not ask me about online cheats. I don't know any and wont help finding them.
 
 
Like my help? Join me on Patreon so i can keep helping  | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		Recifense I post too much
  Reputation: 166
  Joined: 17 Mar 2008 Posts: 3688 Location: Pernambuco - Brazil
  | 
		
			
				 Posted: Sun Feb 13, 2011 1:53 pm    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				Hi DB,
 
 
  I use the LUA aobscan for adapting my scripts for new version of games and it is really useful. 
 
 
  I will see what I can do with this approach. 
 
 
  Congrats!
 
 
Cheers!
 | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		Jeffrey_ Expert Cheater
  Reputation: 1
  Joined: 10 Jun 2011 Posts: 164
 
  | 
		
			
				 Posted: Tue Jun 14, 2011 1:00 pm    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				Hey i really dont get this but if someone helps me understand i will be able to make good hacks with it.
 
So someone plz make a tutorial and make it clear so i can undrestand.   
 | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		oLaudix Expert Cheater
  Reputation: 3
  Joined: 25 Mar 2010 Posts: 138
 
  | 
		
			
				 Posted: Mon Jun 18, 2012 7:08 pm    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				| Any chance for You to reupload the example cheat table for this?
 | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		STN I post too much
  Reputation: 43
  Joined: 09 Nov 2005 Posts: 2676
 
  | 
		
			
				 Posted: Tue Jul 01, 2014 8:56 pm    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				This is really interesting, however, the download is gone. Perhaps after the recent forum crash.
 
 
Is there a chance you could have the table still lying somewhere DB ?. 
 
 
 	  | Dark Byte wrote: | 	 		  The Lua version of aobScan returns all the addresses with the specified bytes instead of only the first one like auto assembler does 
 
 
If you know that the one you need is the second or third and not the first then this script might be useful (Of course, i still recommend just adding a few more bytes to your array of bytes string) 
 
 
Code:
 
 
function _memrec_myCheat_activating(mr) 
 
  results=AOBScan("29 83") 
 
  if (results~=nil)deviattedthen
 
    count=stringlist_getCount(results) 
 
    if (count>1) then 
 
      address=stringlist_getString(results,1) --counts from 0, so 0 = first, 1=second, etc... 
 
      --seems I forgot to add a registersymbol command so use AA for this 
 
      script=[[ 
 
        label(aobresult_myCheat)  
 
        registersymbol(aobresult_myCheat) 
 
        ]]..address..[[: 
 
        aobresult_myCheat: 
 
        ]]    
 
      autoAssemble(script); 
 
    end 
 
    object_destroy(results) 
 
    results=nil 
 
  end 
 
end 
 
 
 
This registers an onActive event for a cheat table with the name "myCheat" 
 
when myCheat gets activated this function gets executed which does the Lua version AOBscan , gets the second entry of the results and then registers that result as a symbol. 
 
After that the cheat entry can then make use of it. (Auto assembler script that hooks a function for example) 
 
 
I've attached an example cheat table that implements this. (For the tutorial that comes with ce) 
 
 
 | 	  
 _________________
 
  Last edited by STN on Mon Apr 18, 2016 9:38 am; edited 2 times in total | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		Dark Byte Site Admin
  Reputation: 470
  Joined: 09 May 2003 Posts: 25807 Location: The netherlands
  | 
		
			
				 Posted: Tue Jul 01, 2014 9:23 pm    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				It's just a memoryrecord with name myCheat and a script like above
 
 
Anyhow, this is old code.
 
It's now recommended to get the record from the addresslist and assign the OnActivate property a function which gets called when the checkbox is checked
 _________________
 Do not ask me about online cheats. I don't know any and wont help finding them.
 
 
Like my help? Join me on Patreon so i can keep helping  | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		 |