 |
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
Ludwig Advanced Cheater
Reputation: 0
Joined: 10 Jan 2016 Posts: 68
|
Posted: Sun Feb 28, 2016 9:15 am Post subject: finding a value of a different type in a trainer |
|
|
hi...
in my trainer...to do a check on an aob i use something like
if AOBScan("2c ?? 0e 25 8c 02") then
do whatever
end
but
in CE..in 4byte mode i can scan for a value like 17736243
...how can i do it in trainer to scan for a value of another type...not an aob?
|
|
Back to top |
|
 |
panraven Grandmaster Cheater
Reputation: 62
Joined: 01 Oct 2008 Posts: 958
|
Posted: Sun Feb 28, 2016 9:42 am Post subject: |
|
|
May try convert the number to aob pattern, ie.
17736243 -> 0x10ea233 -> 33 a2 0e 01, but the scan is slow, and if alignment matter may include false result.
Alternatively, @main.lua, there is memscan class,
Code: | MemScan Class (Inheritance: Object)
getCurrentMemscan() : Returns the current memory scan object. If tabs are used the current tab's memscan object
createMemScan(progressbar OPTIONAL) : Returns a new MemScan class object
|
_________________
- Retarded. |
|
Back to top |
|
 |
Ludwig Advanced Cheater
Reputation: 0
Joined: 10 Jan 2016 Posts: 68
|
Posted: Sun Feb 28, 2016 9:55 am Post subject: |
|
|
panraven wrote: | May try convert the number to aob pattern, ie.
17736243 -> 0x10ea233 -> 33 a2 0e 01, but the scan is slow, and if alignment matter may include false result.
Alternatively, @main.lua, there is memscan class,
Code: | MemScan Class (Inheritance: Object)
getCurrentMemscan() : Returns the current memory scan object. If tabs are used the current tab's memscan object
createMemScan(progressbar OPTIONAL) : Returns a new MemScan class object
|
|
thnx...it worked
btw...how do we give rep here...i can only view rep given...
then
Code: | function DEC_HEX(IN)
local B,K,OUT,I,D=16,"0123456789ABCDEF","",0
while IN>0 do
I=I+1
IN,D=math.floor(IN/B),math.mod(IN,B)+1
OUT=string.sub(K,D,D)..OUT
end
return OUT
end
|
will convert desimal to integer...which i then put into a string...reverse it...check length if even...if not, add a "0"...then break it up into 2 chars with spaces inbetween...which will for my aob...
am i correct, or is ther an easier command line to do it?
|
|
Back to top |
|
 |
panraven Grandmaster Cheater
Reputation: 62
Joined: 01 Oct 2008 Posts: 958
|
Posted: Sun Feb 28, 2016 11:04 am Post subject: |
|
|
Simpler way to convert a number to a hex string is
Code: | string.format("%X",number) |
May try this
Code: | function num2aob(n,nbyte)
assert(type(n)=='number',"num2aob,input not a number:"..tostring(n))
nbyte = type(nbyte)=='number' and nbyte or 4
local ndigit,aob = nbyte*2,{}
local hex = string.format("%0"..ndigit.."X",n) -- at least ndigit
for i=ndigit,1,-2 do -- reverse order
aob[1+#aob] = hex:sub(i-1,i)
end
return table.concat(aob,' ')-- join the parts
end
-- test
-- default dword -> 4 bytes
print(num2aob(17736243))
-- specify qword -> 8 bytes
print(num2aob(17736243,8))
print(num2aob(-17736243,8)) |
_________________
- Retarded. |
|
Back to top |
|
 |
Ludwig Advanced Cheater
Reputation: 0
Joined: 10 Jan 2016 Posts: 68
|
Posted: Sun Feb 28, 2016 12:33 pm Post subject: |
|
|
panraven wrote: | Simpler way to convert a number to a hex string is
Code: | string.format("%X",number) |
May try this
Code: | function num2aob(n,nbyte)
assert(type(n)=='number',"num2aob,input not a number:"..tostring(n))
nbyte = type(nbyte)=='number' and nbyte or 4
local ndigit,aob = nbyte*2,{}
local hex = string.format("%0"..ndigit.."X",n) -- at least ndigit
for i=ndigit,1,-2 do -- reverse order
aob[1+#aob] = hex:sub(i-1,i)
end
return table.concat(aob,' ')-- join the parts
end
-- test
-- default dword -> 4 bytes
print(num2aob(17736243))
-- specify qword -> 8 bytes
print(num2aob(17736243,8))
print(num2aob(-17736243,8)) |
|
hmm...nice...a few more things to research...
thnx a lot for your hlp...
writing it to a txt file...i tried
Code: | local file = io.open("c:\aob.txt", "w")
file:write(newstr)
file:close() |
where "newstr" is the aob we created
but it gives me an error...
"Error:[string "function trainerinput()..."]:141: attempt to index local 'file' (a nil value)"
for line "file:write(newstr)"
viewtopic.php?t=588044
answered the problem at hand...thnx...
Code: | file = io.open("c:\\aob.txt", "w")
file:write(newstr)
file:close() |
|
|
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
|
|