is there any example of simple AOBScan then replace all the result ?
in my case i want scan ?? 00 14 00 0E, the result is more than one
then i want replace all of it with 01 00 14 00 0E
thank you very much
AOBScan and Replace All Result
Re: AOBScan and Replace All Result
You need a unique AOB, or at least narrow it down by using aobscanregion
Re: AOBScan and Replace All Result
[ENABLE]
{$lua}
local pattern = "?? 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00"
local replace = "00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00"
local scans = AOBScan(pattern)
local saved = {}
local length = (#replace + 1) / 3
for i = 0, scans.Count - 1 do
local backup = readBytes(scans[i], length, true)
local bytes = {}
for hex in string.gmatch(replace, "%S+") do
local size = #bytes + 1
if hex == "??" then
bytes[size] = backup[size]
else
bytes[size] = tonumber(hex, 16)
end
end
saved[i] = backup
writeBytes(scans[i], bytes)
end
_G[cheat_name] = {
["scans"] = scans,
["saved"] = saved
}
end
this is already unique and the result between 2-4 result
before i'm using this lua, i was using auto assembly
but assembly just replace the first result
i dont know how to make this lua script works
1. im using auto assembly because i need to set hotkey to it
2. then i change make assemby to {$lua} but it can not working
Re: AOBScan and Replace All Result
thanks already solved this
Re: AOBScan and Replace All Result
ok, first i will let you know about my objective
- I have this specific AOB that i want to search for
- I realize the address always change after I finish the battle or go to the lobby
- I have tried to using pointer and always failed cause when I restart the game, the pointer also change
let's break down the method
- scan the AOB, in this case is "?? 00 00 00 00 00 00 00 00 00 00 00 01"
- it will return with 2 or more result, so we can not use AA Aobscan
- so we use this instead
Code: Select all
local results = AOBScan('?? 00 00 00 00 00 00 00 00 00 00 00 01')
- i tried to scan and add address manually to addresslist and found out that when i change the type to 4bytes, i just need to change the value to 0 (i want to replace ?? with 00)
- then add result.count and writeinteger
Code: Select all
for i=0, results.Count-1 do writeInteger(results[i], 0) end
- the final code should be like this
Code: Select all
loadlibrary(luaclient-i386.dll) luacall(openLuaServer('CELUASERVER')) CELUA_ServerName: db 'CELUASERVER',0 [ENABLE] {$lua} local results = AOBScan('?? 00 00 00 00 00 00 00 00 00 00 00 01') for i=0, results.Count-1 do writeInteger(results[i], 0) end results.destroy() {$asm} [DISABLE] {$lua} local results = AOBScan('?? 00 00 00 00 00 00 00 00 00 00 00 01') for i=0, results.Count-1 do writeInteger(results[i], 0) end results.destroy() {$asm}
because i want to set the assembly script with Hotkey
so when the address change, i just need hit the hotkey (toggle enabled or disabled) then the script will to the magic
whether it enabled or disabled i just dont care, because it will do the same
Re: AOBScan and Replace All Result
If you want to just toggle it without putting the same code in enable and disable just put this at the bottom of your enable script
Code: Select all
local t = createTimer()
t.Interval = 1
t.OnTimer = function(t)
t.destroy()
memrec.Active = false
end
Re: AOBScan and Replace All Result
A few notes:
1) I've been using this code for a while now, adapting it to my needs:
See if it better fits your agenda (I prefer it to using 'aobscan'). Of course, if your scan is supposed to return multiple results, then the last line above should be a loop (like you already presented) in which you'd go through all "sl{i}". (had to use { instead of [, as bbcode would parse it as italics)
2) You can force scripts to error out so they don't enable, both in AA or Lua. Just add one of the snippets below at the end of your [ENABLE] section:
AA:
Lua:
The above are artificial errors. They would run at the end of your [ENABLE], triggering an error, so the script never enables. This might get a bit confusing for people who are used to seeing the "[x]" in front of a script, so they'll whine "script dun werk"
1) I've been using this code for a while now, adapting it to my needs:
Code: Select all
function stopExec( s )
error( print( string.format( "\r\n>> %s <<", s ) ) )
end
function aobScanEx( aob )
-- thanks panraven for this function!
-- https://forum.cheatengine.org/viewtopic.php?t=577536
-- simplified for my needs
-- scan the entire memory space: e = nil or '*X*W'
-- scan only executable code: e = nil or '+X'
local p, a, n, s, e = nil or '+X', nil or fsmNotAligned, nil or '0', getAddress( process ) or 0x0, ( getAddress( process ) + getModuleSize( process ) ) or 0xffffffffffffffff
local ms = pb and createMemScan( pb ) or createMemScan()
local fl = createFoundList( ms )
ms.firstScan( soExactValue, vtByteArray, nil, aob, nil, s, e, p, a, n, true, false, false, false )
ms.waitTillDone()
fl.initialize()
local result = nil
if fl ~= nil and fl.getCount() > 0 then
result = createStringlist()
for i = 1, fl.getCount() do result.add( fl.getAddress( i - 1 ) ) end
end
fl.destroy()
ms.destroy()
return result
end
-- GetOxygen
local aob_GetOxygen = "488BD84885C00F84????????8078??0175??48"
local sl = aobScanEx( aob_GetOxygen )
if not sl or sl.Count < 1 then stopExec( "'aob_GetOxygen' not found." ) end
local t = tonumber( sl[0], 16 )
2) You can force scripts to error out so they don't enable, both in AA or Lua. Just add one of the snippets below at the end of your [ENABLE] section:
AA:
Code: Select all
0:
db 'artificial error so script does not enable',0
Code: Select all
return("assert(true")
Re: AOBScan and Replace All Result
lol yeah I had to put a confirmation message on some things that auto disable because I had a few geniuses like that message me.
Who is online
Users browsing this forum: No registered users