| 
			
				|  | Cheat Engine The Official Site of Cheat Engine
 
 
 |  
 
	
		| View previous topic :: View next topic |  
		| Author | Message |  
		| jeff.artik Guest
 
 
 
 
 
 
 | 
			
				|  Posted: Sun Jun 11, 2017 9:17 am    Post subject: How to find and replace 4bytes values with another one ? |   |  
				| 
 |  
				| Hi, again some difficulties today   
 I'm trying to replace after a scan all "398EE33F" values (addresses always change) with another one: "8EE31840"
 
 When I do a manual scan, and I replace all results, it works. So I wanted to script it with LUA as much as I can (and after few hours of search haha)
 
 
 Here is my script, but doesn't work:
 
 
  	  | Code: |  	  | --Scan local scan = createMemScan(true);
 scan.setOnlyOneResult(false);
 scan.firstScan(ms, soExactValue, vtDword, rtRounded, "398EE33F", nil, 0, 0xffffffffffffffff, "+W", fsmAligned, 4, true, false, false, false);
 scan.waitTillDone();
 
 --Fetch result
 local FoundList=createFoundList(scan);
 FoundList.initialize();
 
 --Overwite
 for i=0,FoundList.Count-1 do
 print(FoundList.Address[i]);
 writeBytes(FoundList.Address[i],"8EE31840");
 end
 
 --Cleanup
 FoundList.deinitialize();
 FoundList.destroy();
 FoundList=nil;
 scan.destroy();
 scan=nil;
 | 
 
 In my case I think my scan works (how to print results?)
 But then I suppose "writeBytes" is not correct. Help is welcome
 |  |  
		| Back to top |  |  
		|  |  
		| atom0s Moderator
 
  Reputation: 205 
 Joined: 25 Jan 2006
 Posts: 8587
 Location: 127.0.0.1
 
 |  |  
		| Back to top |  |  
		|  |  
		|  |  
  
	| 
 
 | You can post new topics in this forum You can 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
 
 |  |