|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
Nicholas Cage Newbie cheater Reputation: 0
Joined: 18 Apr 2014 Posts: 16 Location: no
|
Posted: Fri May 30, 2014 11:06 pm Post subject: Changing AoB's values through a lua script? |
|
|
Yeah.
I'm wondering.
Example:
I have the AoB 00 40 1C 46 00 00 7A 44 01 00 00 00 00 00 7A C4, and I want to change it to 00 40 1C C6 00 00 7A 44 01 00 00 00 00 00 7A C4, but through a script - how would I do it?
|
|
Back to top |
|
|
Nicholas Cage Newbie cheater Reputation: 0
Joined: 18 Apr 2014 Posts: 16 Location: no
|
Posted: Sat May 31, 2014 8:23 pm Post subject: |
|
|
Come on people, please.
I really need to know this quick.
|
|
Back to top |
|
|
justa_dude Grandmaster Cheater Reputation: 23
Joined: 29 Jun 2010 Posts: 891
|
Posted: Sat May 31, 2014 9:04 pm Post subject: |
|
|
aobscan(foo, bytes)
foo:
db changedbytes
_________________
A nagy kapu mellett, mindig van egy kis kapu.
----------------------
Come on... |
|
Back to top |
|
|
DaSpamer Grandmaster Cheater Supreme Reputation: 52
Joined: 13 Sep 2011 Posts: 1578
|
Posted: Sun Jun 01, 2014 6:51 am Post subject: |
|
|
Although there's endless scripts of how to do so.. even a AOBSwap function which does it for you by only supplying scan and replace aobs, heres a simple way to do so.
Kindly use search button, and don't request help until you checked each result and result.
Code: | local scan = '00 40 1C 46 00 00 7A 44 01 00 00 00 00 00 7A C4';
local replace = '00 40 1C C6 00 00 7A 44 01 00 00 00 00 00 7A C4';
local replace_table = {}; -- writeBytes function requires either a table with hex values or parameters with hex values... this converts the string above to a table.
for byte in string.gfind(replace, "[^%s]+") do
table.insert(replace_table, tonumber('0x'..byte));
end
print(unpack(replace_table)); -- Output of table..(table values are parsed as integer).
local data = AOBScan(scan);
if (data) then
local count = data.getCount();
for i=0, count-1 do
local address = data.getString(i);
writeBytes(address, replace_table);
end
end |
Incase you're not using space between bytes, heres a small tweak to use with or without space, just call the function with aob.
Code: | function AOB_to_Table(aob)
local space = (string.find(aob, '%s'))~=nil and true or false
local output = {};
if (space) then
for byte in string.gfind(aob, "[^%s]+") do
table.insert(output, tonumber('0x'..byte));
end
else
for i=1,aob:len(), 2 do
table.insert(output, tonumber('0x' .. string.sub(aob,i,i+1)));
end
end
return output;
end
local scan = '00 40 1C 46 00 00 7A 44 01 00 00 00 00 00 7A C4';
-- local replace = '00 40 1C C6 00 00 7A 44 01 00 00 00 00 00 7A C4';
local replace = '00401CC600007A440100000000007AC4';
local replace_table = AOB_to_Table(replace); -- detects if space is used or not... and returns aob table..
local data = AOBScan(scan);
if (data) then
local count = data.getCount();
for i=0, count-1 do
local address = data.getString(i);
writeBytes(address, replace_table)
end
end |
_________________
|
|
Back to top |
|
|
AiriK How do I cheat? Reputation: 0
Joined: 14 Nov 2014 Posts: 1
|
Posted: Fri Nov 14, 2014 4:09 am Post subject: |
|
|
DaSpamer wrote: |
Code: | local scan = '00 40 1C 46 00 00 7A 44 01 00 00 00 00 00 7A C4';
local replace = '00 40 1C C6 00 00 7A 44 01 00 00 00 00 00 7A C4';
local replace_table = {}; -- writeBytes function requires either a table with hex values or parameters with hex values... this converts the string above to a table.
for byte in string.gfind(replace, "[^%s]+") do
table.insert(replace_table, tonumber('0x'..byte));
end
print(unpack(replace_table)); -- Output of table..(table values are parsed as integer).
local data = AOBScan(scan);
if (data) then
local count = data.getCount();
for i=0, count-1 do
local address = data.getString(i);
writeBytes(address, replace_table);
end
end |
|
does this work with ?? bytes?
im trying to change '01 15 00 00 ?? 00 00 00 01 15 00 00 05 00 00 00 0F 0A 00 00 ?? ?? ?? ?? 01 15 00 00 1A 00 00 00 01 15 00 00 A0 28'
into '01 15 00 00 ?? 00 00 00 01 15 00 00 05 00 00 00 0F 0A 00 00 ?? ?? ?? ?? 01 15 00 00 1A 00 00 00 01 15 00 00 00 00'
but its not working, it changes some else address and make the game crash
|
|
Back to top |
|
|
DaSpamer Grandmaster Cheater Supreme Reputation: 52
Joined: 13 Sep 2011 Posts: 1578
|
Posted: Fri Nov 14, 2014 11:45 am Post subject: |
|
|
There is other scripts.. but anyway made this one
does not care about space, or invalid character (it ignores it).
Code: | function AOBSwap(aob_s, aob_r)
local clean = function (str)
local array = {};
for byte in string.gfind((string.gsub(str,"([^ABCDEFabcdef0123456789?])",'')), '..') do
table.insert(array,byte);
end
return array;
end
local aob_s_arr,aob_r_arr = clean(aob_s),clean(aob_r);
local aobs = AOBScan(table.concat(aob_s_arr, " "));
if (aobs) then
for entry = 0, aobs.Count -1 do
for offset,value in pairs(aob_r_arr) do
if (value and tonumber(value)) then
writeBytes(aobs.getString(entry)..'+' .. string.format("%x",offset-1), tonumber(value,16));
end
end
end
aobs.destroy();
return true
end
return false
end |
_________________
|
|
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
|
|