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 


How to find and replace 4bytes values with another one ?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Discussions -> Guests
View previous topic :: View next topic  
Author Message
jeff.artik
Guest





PostPosted: Sun Jun 11, 2017 9:17 am    Post subject: How to find and replace 4bytes values with another one ? Reply with quote

Hi, again some difficulties today Wink

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: 136

Joined: 25 Jan 2006
Posts: 7216
Location: 127.0.0.1

PostPosted: Sun Jun 11, 2017 1:34 pm    Post subject: Reply with quote

writeBytes expects either an endless list of bytes or a table. You are giving it a string. Use writeInteger instead. The way you are printing the results should work fine. If you are not getting any results your scan may be off due to invalid protection flags.

Something else I noticed though is your firstScan call has extra parameters it shouldn't have.

Code:
firstScan(ms, soExactValue, ...


ms shouldn't be there.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Discussions -> Guests All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites