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 


Advanced scan with Lua?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
BlubBlab
How do I cheat?
Reputation: 0

Joined: 05 Sep 2014
Posts: 6

PostPosted: Fri Sep 05, 2014 6:04 am    Post subject: Advanced scan with Lua? Reply with quote

What I'm searching for is something like:
I have 3 vars with a specific distance/offset to each other and all 3 have different values which I don't know exactly, so I search for all 3 in between x and y(x and y are for all those 3 different)

Is there a way to customize the memory scan so it will do it or can I filter the results of 3 tabs by giving rules?
Back to top
View user's profile Send private message
Redouane
Master Cheater
Reputation: 3

Joined: 05 Sep 2013
Posts: 363
Location: Algeria

PostPosted: Fri Sep 05, 2014 6:45 am    Post subject: Re: Advanced scan with Lua? Reply with quote

BlubBlab wrote:
What I'm searching for is something like:
I have 3 vars with a specific distance/offset to each other and all 3 have different values which I don't know exactly, so I search for all 3 in between x and y(x and y are for all those 3 different)

Is there a way to customize the memory scan so it will do it or can I filter the results of 3 tabs by giving rules?


I think that you should use grouped scan for those,what are the offsets between the addresses?and what are the types of those 3 vars,float?double?4 bytes?
Back to top
View user's profile Send private message
BlubBlab
How do I cheat?
Reputation: 0

Joined: 05 Sep 2014
Posts: 6

PostPosted: Fri Sep 05, 2014 8:01 am    Post subject: Reply with quote

There are 3 floats in a row yeah I found the grouped scan after I posted but I didn't found something for between values for those it is a little bit hard to find exact values. Those are 3 floats in a row

They are basically xyz coordinates of an enemy/mop which I try to find the whole structure for them unfortunately this particular monster won't hold completely still so the values dancing a bit.
Back to top
View user's profile Send private message
BlubBlab
How do I cheat?
Reputation: 0

Joined: 05 Sep 2014
Posts: 6

PostPosted: Tue Sep 09, 2014 12:33 pm    Post subject: Reply with quote

Okay I worked something out myself for an unknown reason it don't work
Code:

function customscan(v1, v2, v3, howmuch)
   local start1 = v1 - howmuch;
   local ende1 = v1 + howmuch;
   local memscan1 = createMemScan()
   local protectionflags = "";
   local foundlist1 = createFoundList(memscan1)
   memscan1.firstScan(soValueBetween, vtSingle,rtExtremerounded, start1, ende1,
               "0","7fffffff",protectionflags,
               fsmAligned,"4",
               false, false, false, false)
   memscan1.waitTillDone()
   foundlist1.initialize()
 
   local start2 = v2 - howmuch;
   local ende2 = v2 + howmuch;
   local memscan2 = createMemScan()
   local foundlist2 = createFoundList(memscan2)
   memscan2.firstScan(soValueBetween, vtSingle,rtExtremerounded, start2, ende2,
               "0","7fffffff",protectionflags,
               fsmAligned,"4",
               false, false, false, false)
   memscan2.waitTillDone()
   foundlist2.initialize()
 
   local start3 = v3 - howmuch;
   local ende3 = v3 + howmuch;
   local memscan3 = createMemScan()
   local foundlist3 = createFoundList(memscan3)
   memscan3.firstScan(soValueBetween, vtSingle,rtExtremerounded, start3, ende3,
               "0","7fffffff",protectionflags,
               fsmAligned,"4",
               false, false, false, false)
   memscan3.waitTillDone()
   foundlist3.initialize()
 
   local result  = {};
   local list1 = {};
   local list2 = {};
   local list3 = {};
   local resultcounter = 0;
   
   for i=0,foundlist1.Count-1 do
      if(foundlist1.getAddress(i) ~= nil)then
         local adress = string.format("%X",tonumber(foundlist1.getAddress(i),16));
         list1[adress]= foundlist1.getValue(i)
      end
   end
   for i=0,foundlist2.Count-1 do
      if(foundlist2.getAddress(i) ~= nil)then
         local adress = string.format("%X",tonumber(foundlist2.getAddress(i),16));
         --print(" list 2: "..adress.."");
         list2[adress]= foundlist2.getValue(i)
      end
   end
   for i=0,foundlist3.Count-1 do
      if(foundlist3.getAddress(i) ~= nil)then
         local adress = string.format("%X",tonumber(foundlist3.getAddress(i),16));
         --print(" list 3: "..adress.."");
         list3[adress]= foundlist3.getValue(i)
      end
   end
    for key,value in pairs(list1) do
         local keyholder = tonumber(key,16)
       local m1 = keyholder + 4; -- we add 4 bytes
       local m2 = keyholder + 8; -- we add 8 bytes (4 more)
       local s1 = string.format("%X", m1);
       local s2 = string.format("%X", m2);
      ---print("byte1 "..key.." byte2: "..s1.." byte3: "..s2.."");
       if(list2[s1]~=nil and list3[s2]~=nil)then
          print("found at adresse: "..key.." value: "..value.."");
         resultcounter = resultcounter +1;
         result[resultcounter] = list1[key];
       end
     end
    for key,value in pairs(result) do
           print("found at adresse: "..key.." value: "..value.."");
     end
end

EDIT: Found it
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