 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
Kamd Cheater
Reputation: 1
Joined: 02 May 2018 Posts: 28
|
Posted: Fri Nov 16, 2018 7:32 pm Post subject: How to properly scan for strings in memory? |
|
|
I have been trying to scan and replace strings in memory with Lua.
Just as an example, I want to scan for all strings "hey" and replace them with "bye"
I have tried using the following code, but I noticed that it does not actually return ALL the strings. I have found this out when I scan for "hey" in CE, then run my Lua script, but some results found in CE never get replaced (maybe only 70% of results do)
Probably because I am doing something wrong with parameters, I don't understand most.
Code:
| Code: |
function scanStr()
ms=createMemScan()
ms.firstScan(soExactValue,vtString,"hey","hey",0, 0xffffffffffffffff, "", fsmNotAligned, "1", false, false, false, false)
ms.onScanDone = function(ms)
f=createFoundList(ms);
f.initialize();
-- .. etc ..
end
|
As an alternative, I have converted the string to hex byte and use AOB scan, which has always worked correctly, but I notice that it is slower than using regular string scan.
I believe these are the default string scan options I need: (attached)
| Description: |
| settings of CE string scan |
|
| Filesize: |
15.97 KB |
| Viewed: |
2855 Time(s) |

|
|
|
| Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4711
|
Posted: Fri Nov 16, 2018 10:16 pm Post subject: |
|
|
celua.txt:
| Quote: | | firstScan(scanoption, vartype, roundingtype, input1, input2 ,startAddress ,stopAddress ,protectionflags ,alignmenttype ,"alignmentparam" ,isHexadecimalInput ,isNotABinaryString, isunicodescan, iscasesensitive); |
Your code ignores the rounding type parameter which throws all the other parameters off. It's not relevant for a string scan, so just pass rtRounded.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
| 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
|
|