|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
thenewcomer Newbie cheater Reputation: 0
Joined: 09 Mar 2013 Posts: 22 Location: Behind you
|
|
Back to top |
|
|
panraven Grandmaster Cheater Reputation: 55
Joined: 01 Oct 2008 Posts: 942
|
Posted: Sat Sep 27, 2014 3:22 pm Post subject: |
|
|
If AOBScan failed, it return nil, otherwise it return a Stringlist object, which is of lua type userdata. By userdata, it normally cannot be manipulated by lua intrinsic function or statement, but by its own api. That's the 'userdata not string' error I guess.
[You can check Stringlists api from main.lua (a big comment as a document, you insert your own lua code so that they load wen ce start) at your ce install location.]
The Stringlist returned by AOBScan is a collection of strings which is the hexidecimal string representation of result address. For example, memory address 1000(dec) = 0x3e8 (hex) is a string '3e8' in the Stringlist.
Stringlist is subclass of Strings (also ce userdata).
To get how many string in the stringlists, aob.getCount()
To get the ith string, aob[i-1] or aob.getStrings(i-1)
Note aob is not table/array in itself, but aob.String is. but its index is base-0, lua use base-1, a base-0 array cannot get its lua array length by #array correctly, ie. #aob return error, #ab.String will return 0 (not as expected).
Most ce api, eg readBytes, accept the address parameter as string form or number form. So you can convert the string to a number and add a offset then use this resulted number of type 'number' as address parameter, eg offsetAddr = aob[0] + 123 ; readBytes(offsetAddr,100)
The address result is in string form to best interacte with the powerful autoAssemble function.
btw, Your readBytes need a second parameter of how many bytes to read
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25295 Location: The netherlands
|
Posted: Sat Sep 27, 2014 3:32 pm Post subject: |
|
|
Try to specify exactly what you wish to do before doing it
AOBScan is not going to help you with counting the number of bytes in an AOB string as it only returns addresses. And address sizes go from the address they are in to 0xffffffffffffffff
and counting the size of an address returned by the aobscan stringlist is always at least 8
You probably want to count the number of bytes in the search string provided.
I recommend manually chopping up the string into pieces and parse that yourself
keep in mind that aobscan strings can be formatted as:
"10 11 12 ? 14 15"
"10 11 12 ?? 14 15"
"101123??1415"
"10 11 12 z 14 15"
"101112zz1415"
_________________
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 |
|
|
thenewcomer Newbie cheater Reputation: 0
Joined: 09 Mar 2013 Posts: 22 Location: Behind you
|
Posted: Sat Sep 27, 2014 5:12 pm Post subject: |
|
|
what i ended up doing was this
Code: |
function countBytes(search, change)
aob = AOBScan(search)
if(aob ~= nil) then
a = (search) --set a to the aob
b = (string.len(a)) --get the length in decimal
c = ((b-2)/3) --set to offset and count by bytes rather than characters
s = DEC_HEX(c) --convert to hex
print (s) --output number as hex
end
object_destroy(aob);
aob=nil
end
|
i realized i didnt need to use (aob) as the parameter since i already checked if it returned a result or not. duh! thanks for your help guys!
heres my final product
Code: |
function countBytes(search)
aob = AOBScan(search)
if(aob ~= nil) then
s = DEC_HEX(((string.len(search))-2)/3) --do everything(is there enough parenthesis? lol)
print (s) --output number
end
object_destroy(aob);
aob=nil
end |
_________________
-TNC |
|
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 cannot download files in this forum
|
|