|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
god-velocity How do I cheat? Reputation: 0
Joined: 18 May 2017 Posts: 1
|
Posted: Fri May 19, 2017 3:48 am Post subject: Scan results XOR with LUA |
|
|
Hallo, I am new to LUA and scripting in Cheat Engine.
After doing an "unknown initial value" 4Byte scan and doing a next scan with "changed value" I found around 4000 addresses from my scan results. After this I am looking for 2 addresses with a XOR value of, let's say 3. The offset of the 2 addreses should only be a multiple of 0x10 (eg. 0x10,0x20,0x30 etc.).
I managed to find the addresses manually and wanted to write a script to make the process easier, but Cheat Engine went totally unresponsive (not responding) when I execute my script. Below is my script:
getCurrentMemscan()
b=0xba01a400
for a=0xba0173d0,b,16 do
for c=a,b,16 do
val1 = readInteger(a)
val2 = readInteger(c)
e = bXor(val1,val2)
if e==3 then print(a,c) end
end
end
0xBA0173D0 is the beginning and 0xBA01A400 is the end of my found address.
Can someone give me a clue as to why the script went unresponsive or any idea to make the script better?
Thanks in advance.
|
|
Back to top |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Fri May 19, 2017 6:41 am Post subject: |
|
|
Right-click on the Value Type dropdown and define a new custom type.
|
|
Back to top |
|
|
FreeER Grandmaster Cheater Supreme Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Fri May 19, 2017 7:32 am Post subject: |
|
|
While lua is easier to write/understand it is also going to be slower than an assembly script (not sure of any way to get the currentScan in typical asm but you could use a custom type like Zanzer mentioned and each value would be passed to your script as it scans)...
However it looks like you're trying to xor every value with every value that comes after it, if you have 4000 values then the first gets tested with 3999 values, the second with 3998 https://www.mathsisfun.com/numbers/sigma-calculator.html says that'd be about 7998000 checks in total.... you can't narrow it down any? Even in asm that's going to take awhile.... If you really need to do that then at least read val1 (a) only 1 time (in the first loop) since it (in theory) shouldn't be changing while being tested against every other value...
As for "the offset of the 2 addreses should only be a multiple of 0x10" you can do that simply by setting the alignment to "10" when scanning, and the range of 0xba0173d0 - 0xba01a400 can be done by setting the start and stop values when scanning. No need to implement that logic in your script.
|
|
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
|
|