Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


How to call the exact aob and save intu a local variable

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Ludwig
Advanced Cheater
Reputation: 0

Joined: 10 Jan 2016
Posts: 68

PostPosted: Thu Mar 17, 2016 12:09 pm    Post subject: How to call the exact aob and save intu a local variable Reply with quote

hi guys
im strugling a little...
im trying to figure out how to take an aob that uses wilds example
62 ?? 66 ?? ?? 73 63 ?? 62 ?? 66 ?? ?? 66 ?? 73
which if i scan it say this week it gives an exact value of
62 07 66 8A 0C 73 63 09 62 08 66 FE 02 66 44 73
but nxt week it might b different on the parts where there is wilds used...

so to come to the point...i want to do an aob scan for 62 ?? 66 ?? ?? 73 63 ?? 62 ?? 66 ?? ?? 66 ?? 73 on the current game version...get 62 07 66 8A 0C 73 63 09 62 08 66 FE 02 66 44 73 as a result, and put the result into a local...say local myobstr=aobcanresult

the reason being, i need some aob parts from specific functions to rebuild an replace aob for another scan...i want it to auto update...thus i make use of wilds, as deobfuscation make them change regularly...
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Thu Mar 17, 2016 12:26 pm    Post subject: Reply with quote

You can try readmem.
Back to top
View user's profile Send private message
Ludwig
Advanced Cheater
Reputation: 0

Joined: 10 Jan 2016
Posts: 68

PostPosted: Thu Mar 17, 2016 12:50 pm    Post subject: Reply with quote

++METHOS wrote:
You can try readmem.

hmm..the readmem function looks a little difficult...i dont understand it yet...
will it b something like
aobscan(myaobcanresult,62 ?? 66 ?? ?? 73 63 ?? 62 ?? 66 ?? ?? 66 ?? 73)

local myobstr=readmem(myaobcanresult,16)

the readmem parts i saw got me a bit lost...as it looked different from the other lua script ivew been trying to learn...
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Thu Mar 17, 2016 12:56 pm    Post subject: Reply with quote

I'm not entirely sure what it is, exactly, that you are trying to accomplish (or avoid). Can you explain it, please?

Regarding readmem, if you can explain your issue and paste your script here, perhaps members can just show you what you need to do. Anything regarding LUA will have to be answered by others, as I am not proficient with that.
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 62

Joined: 01 Oct 2008
Posts: 958

PostPosted: Thu Mar 17, 2016 1:09 pm    Post subject: Reply with quote

readmem is an AA command, not lua function, the desc in ce help file:
Code:
READMEM(address,size) :Will write the addresses at address at the location this instruction is placed


The list address is the source address where bytes will be copy from, size is how many byte to copy, in DECIMAL. The target address is the implicit address where the command is.

The lua equivalent may be some thing like this:

Code:
writeBytes(targetAddress,readBytes(sourceAddress,size,true))


bye~

_________________
- Retarded.
Back to top
View user's profile Send private message
Ludwig
Advanced Cheater
Reputation: 0

Joined: 10 Jan 2016
Posts: 68

PostPosted: Thu Mar 17, 2016 1:19 pm    Post subject: Reply with quote

i will try to explain some more...
lets say aob1="24 ?? 62 05 66 ?? ?? 4f ?? ?? ?? ?? " <one function>
aob2="00 d1 2c ?? ??" <from 2nd function>
aob3="63 ?? 27 63 ?? ??" <from 3rd function>
so...what i wish to acomplish is something like
aobswap(aob1, aob2..aob3)

but, because of the wildcards, aob2 and aob43 isnt exact aob values, but when they get scanned exact vaues get filled into the "??" spaces...so,
the aob2 "00 d1 2c ?? ??" must become something like local aob2exact="00 d1 2c aa bb"
and the aob3 "63 ?? 27 63 ?? ??" must become something like local aob3exac"63 dd 27 63 ee ff",,,but i dont know how to get it from "63 ?? 27 63 ?? ??" to "63 dd 27 63 ee ff"...

because if a kust put them together like aobswap(aob1, aob2..aob3) the "??" for aob1 will be used in the replace...

hvnt made that part of the script yet...stll trying to figure out how to get the ?? issue solved

edit...
can i say aob2exact = AOBScan(aob2)
will that give me the result "00 d1 2c aa bb" ?

i always thought AOBScan() just returns a true or false depending on if it finds the aob or not...
i will put it to the test...might hv found my own anser...
Smile...thnx guys


Last edited by Ludwig on Thu Mar 17, 2016 1:29 pm; edited 1 time in total
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Thu Mar 17, 2016 1:27 pm    Post subject: Reply with quote

panraven wrote:
readmem is an AA command, not lua function
-Yes, I know. But the OP is posting in the LUA sub-forum, so I assume an LUA solution was needed. Very Happy

Ludwig-
You may need to use readmem in conjunction with aobswap. I've never had a need to use the aobswap feature, so I cannot say for certain how it would need to be done.
Back to top
View user's profile Send private message
Ludwig
Advanced Cheater
Reputation: 0

Joined: 10 Jan 2016
Posts: 68

PostPosted: Thu Mar 17, 2016 1:45 pm    Post subject: Reply with quote

++METHOS wrote:


Ludwig-
You may need to use readmem in conjunction with aobswap. I've never had a need to use the aobswap feature, so I cannot say for certain how it would need to be done.


at the moment my script uses
luacall(AobswapC("00 84 ?? ?? ?? 80 64 ?? 0d 03 0d 66","d0 30 24 00 48"))
for most aobs...where AobswapC is a function made up already to do the swap...but...as i tried to explain above...some replace aobs is a bit more tricky...i basically need to "build" the replace ob from data in other functions...which i can scan aswell..
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Thu Mar 17, 2016 10:14 pm    Post subject: Reply with quote

Code:
[ENABLE]
aobscan(scan1,00 84 ?? ?? ?? 80 64 ?? 0d 03 0d 66)
aobscan(scan2,00 d1 2c ?? ??)
aobscan(scan3,63 ?? 27 63 ?? ??)
scan1:
readmem(scan2,5)
readmem(scan3,6)
[DISABLE]
Back to top
View user's profile Send private message
Ludwig
Advanced Cheater
Reputation: 0

Joined: 10 Jan 2016
Posts: 68

PostPosted: Thu Mar 24, 2016 6:33 am    Post subject: Reply with quote

Nope...ive tried these above...i get errors trying to use
[ENABLE]
or the code below it...

so...i tried this by myself below

Code:

function AobBuild()

local scan1=''
local scan2=''
local search=''
local replace=''
local stringbuild1=''
local mystr=" "
local i=0;
local j=0;



scan1 = AOBScan("d0 30 60 ?? 01 66 ?? ?? d0 66 ?? ?? 66 ?? ?? 02 80 04 d5 d0 66 ?? ?? 46 ?? ?? ?? ?? ??")
if scan1~=nil then
 j = stringlist_getCount(scan1)
   for i = 1, j do
     stringbuild1=stringlist_getString(scan1,i-1)
      mystr= mystr..stringbuild1
   end
   scan2 =  mystr
showMessage("scan1: "..scan2)

end

end


"scan1 0808B0A4"

is what i get atm
this gives me the address of scan1...instead of the value...



"scan1 D0 30 60 96 01 66 8C 0A D0 66 82 08 66 AB CB 02 80 04 D5 D0 66 A1 0A 46 58 00 D1 66 81"

is what i would like

Any idea how i can get it to put the value of that scan into scan2?


EDIT---

ok..got it sorted with this...:

Code:
function DEC_HEX2(IN)
   if IN<=0 then
      return '0'
   end
   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
function AobBuild()

local scan1=''
local mystr=" "
local Address = scan1[0];
local ReadBytes = readBytes(Address,29,true);
for _,String in pairs(ReadBytes) do
   local Hex = DEC_HEX2(String);
   if Hex:len()==1 then
      Hex = '0' .. Hex;
   end
   ReadBytes[_] = Hex;
   mystr= mystr..Hex.." ";
end
showMessage(mystr);
end;
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites