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 


Remove Results in Found List via Filter

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting -> Lua Extensions
View previous topic :: View next topic  
Author Message
ParkourPenguin
Grandmaster Cheater Supreme
Reputation: 54

Joined: 06 Jul 2014
Posts: 1814
Location: Arcadian Suburbia

PostPosted: Sat Jul 30, 2016 10:45 pm    Post subject: Remove Results in Found List via Filter Reply with quote

A little script I threw together.

It adds a menu item to the found list's right click menu with the caption "Remove addresses using filter". It allows you to remove records from the found list based on the records' addresses, current values, and previous values. Return true if you want to remove any given record.

All 3 parameters (address, currentValue, previousValue) are strings and should be cast to numbers if needed.
If you're hiding the previous value column, previousValue will not be valid. (the previous value isn't explicitly exposed to Lua AFAIK, and I'm not going to look through the disk for it)
Code:
-- initial declarations
local fl = getMainForm().Foundlist3
local input = "currentValue ~= previousValue"
local miRemove
for i=0, fl.PopupMenu.Items.Count-1 do
  if fl.PopupMenu.Items[i].Name == "Removeselectedaddresses1" then
    miRemove = fl.PopupMenu.Items[i]
    break
  end
end
assert(miRemove,"Remove addresses using filter failed; could not find Removeselectedaddresses1 menu item")

-- create menu item
local mi = createMenuItem(fl.PopupMenu)
mi.Caption = "Remove addresses using filter"
mi.OnClick = function()
  --get the filter
  input = inputQuery(mi.Caption, "Type Lua code resulting in a boolean value. Function declared as:\nfunction (address, currentValue, previousValue) : boolean", input)
  if not input then return end

  local filter = assert(loadstring("local address, currentValue, previousValue = ...; return " .. input))

  -- select the items to remove
  for i=0, fl.Items.Count-1 do
    fl.Items[i].Selected = filter(fl.Items[i].Caption, fl.Items[i].SubItems[0], fl.Items[i].SubItems[1]) == true
  end

  -- execute the "Remove selected addresses" menu item
  miRemove.DoClick()
end

-- add new menu item just after the "remove selected" menu item
fl.PopupMenu.Items.insert(miRemove.MenuIndex+1, mi)

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 26

Joined: 01 Oct 2008
Posts: 662

PostPosted: Sun Jul 31, 2016 1:45 am    Post subject: Reply with quote

Thank you~

Dark Byte mentioned getCurrentMemscan().ScanResultFolder in forum,
checking that directory during scan, it seems previous result and also first result can be referenced by Lua file operation. I guess UNDO is previous result, TMP is current. UNDO only appeared after 2nd scan.

bye~



ceScanResultFolder.jpg
 Description:
 Filesize:  26.8 KB
 Viewed:  9278 Time(s)

ceScanResultFolder.jpg



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

Joined: 30 Jul 2016
Posts: 43

PostPosted: Sun Jul 31, 2016 2:08 am    Post subject: Re: Remove Results in Found List via Filter Reply with quote

ok i executed your script now to filter option shows up once i use it
a popup menu shows up telling me to type lua code resulting in Boolean
what should i type ?

Code:
tonumber(currentValue) ~= previousValue+5 and tonumber(currentValue) ~= previousValue-5


and it didn't work well because the remaining list is 200K

i think its huge number for a script to handle Embarassed

is there any way to enhance to code to make it work faster
it works perfectly fine if the list is small
Back to top
View user's profile Send private message
ParkourPenguin
Grandmaster Cheater Supreme
Reputation: 54

Joined: 06 Jul 2014
Posts: 1814
Location: Arcadian Suburbia

PostPosted: Sun Jul 31, 2016 10:19 am    Post subject: Reply with quote

panraven:
I knew about that; it's just I don't want to go through each file and parse the raw data.

mbabo:
Lua isn't a fast language. It's possible to increase the speed of it marginally the way it is now, but you should be able to get the scan results down to manageable levels with enough changed/unchanged value scans.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
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 -> Lua Extensions 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