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 


script that can search for values and then replace them ALL?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
XaneXXXX
Expert Cheater
Reputation: 0

Joined: 29 Nov 2012
Posts: 212

PostPosted: Sat Apr 25, 2015 6:34 pm    Post subject: script that can search for values and then replace them ALL? Reply with quote

Does anyone know a script/another way for cheat engine to search for a value let's say "28375657" and replace ALL the results that come up with like 99999999?

i need this to work in my lua/trainer, and it needs to use DECIMAL as input!

Thanks!
Back to top
View user's profile Send private message
alanze
Advanced Cheater
Reputation: 3

Joined: 03 Oct 2012
Posts: 50

PostPosted: Sun Apr 26, 2015 10:59 pm    Post subject: Reply with quote

Put this in the lua script window and execute:
Code:

-- use numbers between 0 and 4294967295
-- do not use float numbers or text
-- else you get error

nr=28375657  -- put "number to replace" here
rw=99999999  -- put "replace with" here

function replaceAllInt()
 local t1=""
 local t2=string.format("%X",nr)
 while (string.len(t2) < 8) do t2="0"..t2 end
 for x=7, 0, -2 do t1=string.sub(t2,x,x+1).." " end
 rs=AOBScan(t1,"+W-X-C",1,"4")
 if (rs) then
  local lngt=rs.getCount()
  for x=0, lngt-1, 1 do writeInteger(rs[x],rw) end
  rs.Destroy()
  rs=nil
 end
end
replaceAllInt()


Do not touch the function except +W-X-C (which memory area you want to search)
Also you can use "createMemScan(0)" as an alternative (if you know how to use it).
It's dangerous to replace all integer values found in memory,
at least 90% that the game will crash, depends how specific is the number, good luck.
Another user asked for the same, check out:
http://forum.cheatengine.org/viewtopic.php?p=5590937
    Back to top
    View user's profile Send private message
    Display posts from previous:   
    Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting 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