| View previous topic :: View next topic |
| Author |
Message |
samuraiboss666 Newbie cheater
Reputation: 0
Joined: 03 Dec 2016 Posts: 19
|
Posted: Sun Dec 18, 2016 2:31 pm Post subject: Trying to multiply the first byte in AOB string |
|
|
Hello,
I am trying to multiply single byte in AOB string By 2. It does something to the value but it also does something to the first 4bytes. I would like the program to multiply only the first byte. This is what my code looks like.
_____________________________________________________________
[ENABLE]
aobscan(INJECT,07 01 01 01 3B 03 01 5F 00 00 00 00 00 00 00 00 08 00 00 00 2A A0 00 01 00 00 00 00 00 00 4A 00) // should be unique
alloc(INJECT_newmem,$1000)
alloc(INJECT_Base,1)
label(code)
label(return)
INJECT_newmem:
code:
mov eax,2
imul eax,INJECT
jmp return
INJECT:
jmp code
return:
registersymbol(INJECT)
[DISABLE]
INJECT:
db 07 01 01 01 3B 03 01 5F 00 00 00 00 00 00 00 00 08 00 00 00 2A A0 00 01 00 00 00 00 00 00 4A 00
unregistersymbol(INJECT)
dealloc(newmem)
_____________________________________________________________
Can someone help me out here?
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25833 Location: The netherlands
|
Posted: Sun Dec 18, 2016 6:27 pm Post subject: |
|
|
| Code: |
[enabe]
aobscan(INJECT,07 01 01 01 3B 03 01 5F 00 00 00 00 00 00 00 00 08 00 00 00 2A A0 00 01 00 00 00 00 00 00 4A 00)
registersymbol(INJECT)
INJECT:
db 0e
[disable]
INJECT:
db 07 01 01 01 3B 03 01 5F 00 00 00 00 00 00 00 00 08 00 00 00 2A A0 00 01 00 00 00 00 00 00 4A 00
unregistersymbol(INJECT)
|
or
| Code: |
[enable]
{$lua}
local ms=createMemScan(nil)
ms.OnlyOneResult=true
ms.firstScan(soExactValue,vtByteArray,rtRounded, '07 01 01 01 3B 03 01 5F 00 00 00 00 00 00 00 00 08 00 00 00 2A A0 00 01 00 00 00 00 00 00 4A 00', '', 0, 0x7fffffffffffffff, '', fsmNotAligned, '', true,false,false,false)
ms.waitTillDone()
local r=[[%x:
db %x
]]
r=string.format(r,ms.Result,readBytes(ms.Result,1)*2)
unregisterSymbol('INJECT')
registerSymbol('INJECT',ms.Result)
ms.Destroy()
return r
[disable]
INJECT:
db 07 01 01 01 3B 03 01 5F 00 00 00 00 00 00 00 00 08 00 00 00 2A A0 00 01 00 00 00 00 00 00 4A 00
unregistersymbol(INJECT)
|
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
samuraiboss666 Newbie cheater
Reputation: 0
Joined: 03 Dec 2016 Posts: 19
|
Posted: Sun Dec 18, 2016 9:51 pm Post subject: |
|
|
Thank you
I don't really understand much about the 2nd example but the first one is clear and that's how I've been doing things before I started trying the whole memory hack stuff.
-samurai
|
|
| Back to top |
|
 |
samuraiboss666 Newbie cheater
Reputation: 0
Joined: 03 Dec 2016 Posts: 19
|
Posted: Tue Dec 20, 2016 10:35 am Post subject: |
|
|
Ok so I managed to get my code working. But I ran into a problem. The AOBScan injection only happens to apply to the first entry of the string it runs into but not the others after that. I got a situation where there are 7 enemies of same type in 1 fight. I would like to apply the changes to all 7 at once.
My code looks like this right now:
_____________________________________________________________
[ENABLE]
aobscan(INJECT,64 00 00 00 00 00 00 00 F4 01 00 00 05 01 01 01 08 )
registersymbol(INJECT)
INJECT+C:
db 08
INJECT+E:
db 01
INJECT+10:
db 0A
[DISABLE]
INJECT:
db 64 00 00 00 00 00 00 00 F4 01 00 00 05 01 01 01 08
unregistersymbol(INJECT)
_____________________________________________________________
I inject 8 in place of of 5 and 0A in place of 8. I also have inject+e there cause I will need that for other enemies. The 7 enemies are F90 hexas from eachother
How should I change my code so that the change would apply to all 7 enemies at once?
|
|
| Back to top |
|
 |
Zanzer I post too much
Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
|
| Back to top |
|
 |
samuraiboss666 Newbie cheater
Reputation: 0
Joined: 03 Dec 2016 Posts: 19
|
Posted: Tue Dec 20, 2016 9:22 pm Post subject: |
|
|
| Whenever I try to apply Lua section to my code I get errors even though I've copy pasted exactly what you write here. Do I need to download Lua to Cheat Engine or something? I'm using 6.6 (the latest version).
|
|
| Back to top |
|
 |
Zanzer I post too much
Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Tue Dec 20, 2016 9:30 pm Post subject: |
|
|
| Are you pasting them into the same place as your AA scripts? Ctrl+Alt+A
|
|
| Back to top |
|
 |
samuraiboss666 Newbie cheater
Reputation: 0
Joined: 03 Dec 2016 Posts: 19
|
Posted: Tue Dec 20, 2016 11:59 pm Post subject: |
|
|
Take this code for example:
_____________________________________________________________
[ENABLE]
aobscan(INJECT,64 00 00 00 00 00 00 00 F4 01 00 00 05 01 01 01 08 ) // should be unique
alloc(newmem,$1000)
registersymbol(INJECT)
newmem:
luacall(writeBytes("INJECT+C", readBytes("INJECT+C", 1) * 2))
[DISABLE]
INJECT+C:
db 05 01 01 01 08
unregistersymbol(INJECT)
dealloc(newmem)
_____________________________________________________________
CE claims i'm trying to do artihmetic on nil value, which is not true at all since the value i'm trying to change is 5. Yes, it is AA script.
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25833 Location: The netherlands
|
Posted: Wed Dec 21, 2016 6:38 pm Post subject: |
|
|
try readBytes(INJECT+C, 1)
it also won't do what you want though (only the first occurance)
(also, luacall doesn't work the way you think it does. it doesn't matter where you put it, so the newmem is not needed)
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
Zanzer I post too much
Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Wed Dec 21, 2016 8:50 pm Post subject: |
|
|
| Code: | {$lua}
if syntaxcheck then return end
cheat_name = "MyCheat"
[ENABLE]
local pattern = "64 00 00 00 00 00 00 00 F4 01 00 00 05 01 01 01 08"
local replace = "?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 0A ?? ?? ?? ??"
-- edit the name of the cheat
-- edit the pattern to search
-- edit the replacement bytes
-- use ?? to ignore the bytes
-- do not edit the code below
local scans = AOBScan(pattern)
if scans == nil then
showMessage("Unable to find pattern:\n"..pattern)
else
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
[DISABLE]
local vars = _G[cheat_name]
if vars ~= nil then
local scans = vars.scans
local saved = vars.saved
for i = 0, scans.Count - 1 do
writeBytes(scans[i], saved[i])
end
scans.Destroy()
vars.scans = nil
vars.saved = nil
vars = nil
_G[cheat_name] = nil
end |
|
|
| Back to top |
|
 |
samuraiboss666 Newbie cheater
Reputation: 0
Joined: 03 Dec 2016 Posts: 19
|
Posted: Wed Dec 21, 2016 9:52 pm Post subject: |
|
|
This line
luacall(writeBytes("INJECT+C", readBytes("INJECT+C", 1) * 2))
simply never stops complaining even if I remove quotation marks from either or both of the INJECT+C lines.
And Zanzer, that is really good code. It works for me probably cause it's completely Lua. Could you make me an example of 2 AOB entries in the same code with the message that CE couldn't find the byte string removed.
Also, the enemy bytes I'm trying to modify simply pop out of nowhere when the game has them in battle and I can't seem to be able to activate the code before the battle begins cause of that. So I'm wondering how will I be able to have the code activated before the fight with the values begins?
Edit:
Also in this code...
_____________________________________________________________
{$lua}
if syntaxcheck then return end
cheat_name = "INJECT"
[ENABLE]
local pattern = "64 00 00 00 00 00 00 00 F4 01 00 00 05 01 01 01 08"
local replace = "?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 08 ?? 01 ?? 0A"
-- edit the name of the cheat
-- edit the pattern to search
-- edit the replacement bytes
-- use ?? to ignore the bytes
-- do not edit the code below
local scans = AOBScan(pattern)
if scans == nil then
showMessage("Unable to find pattern:\n"..pattern)
else
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
[DISABLE]
local vars = _G[cheat_name]
if vars ~= nil then
local scans = vars.scans
local saved = vars.saved
for i = 0, scans.Count - 1 do
writeBytes(scans[i], saved[i])
end
scans.Destroy()
vars.scans = nil
vars.saved = nil
vars = nil
_G[cheat_name] = nil
end
_____________________________________________________________
another entry keeps comboing with this one, with this code changing 5 to 8 the other code changes 8 to A. Is it possible somehow for the codes to only apply to the original value and not replaced value?
|
|
| Back to top |
|
 |
|