|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4300
|
Posted: Sat Jul 30, 2016 10:45 pm Post subject: Remove Results in Found List via Filter |
|
|
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 |
|
|
panraven Grandmaster Cheater Reputation: 55
Joined: 01 Oct 2008 Posts: 942
|
Posted: Sun Jul 31, 2016 1:45 am Post subject: |
|
|
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~
Description: |
|
Filesize: |
26.8 KB |
Viewed: |
36958 Time(s) |
|
_________________
- Retarded. |
|
Back to top |
|
|
mbabo Advanced Cheater Reputation: 0
Joined: 30 Jul 2016 Posts: 74
|
Posted: Sun Jul 31, 2016 2:08 am Post subject: Re: Remove Results in Found List via Filter |
|
|
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
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 |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4300
|
Posted: Sun Jul 31, 2016 10:19 am Post subject: |
|
|
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 |
|
|
vovasivy Cheater Reputation: 0
Joined: 09 Jun 2021 Posts: 39
|
Posted: Sun Sep 26, 2021 3:14 am Post subject: |
|
|
ParkourPenguin:
I'm trying to change your script for today's conditions, if you don't mind, of course.
I'm not familiar with programming well, I can't figure out how to synchronize the number of arguments in the function:
Code: |
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], fl.Items[i].SubItems[2]) == true
end
|
with the number of columns in the Foundlist.
I would be grateful if you help.
Code: |
-- initial declarations
local fl = getMainForm().Foundlist3
local input = "Value ~= Previous and Value == First"
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, Value, Previous, ..., First) : boolean.\n\" Remove the address if the condition is TRUE \"", input)
if not input then return end
local cap = ""
for i=0, fl.Columns.Count-2 do
cap = cap..fl.Columns[i].Caption..", "
end
local filter = assert(loadstring("local "..cap.." First = ...; 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], fl.Items[i].SubItems[2]) == 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)
--[[
Example:
Float/Duble: Previous-Value<0.0 or First-Previous>7.086
Value-Previous<60.000 and First-Previous>120.000
Integer: Previous-Value<12356 or First-Previous>73086
Value-Previous<60000 and First-Previous>120000
tonumber(Value)==94 and tonumber(Previous)==73 and tonumber(First)==127
--]]
|
|
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4300
|
Posted: Sun Sep 26, 2021 12:12 pm Post subject: |
|
|
Honestly I don't even remember making this script. Going through the foundlist like that is so slow I wonder if the script is useful.
You can put the arguments into a Lua array (a table w/ integer keys starting at 1) and use table.unpack to turn them into values.
Something like this:
Code: | -- ...
local columns = {}
for i = 0, fl.Columns.Count - 1 do
columns[#columns+1] = fl.Columns[i].Caption
end
columns = table.concat(columns, ', ')
--get the filter
local input = 'Value ~= Previous'
input = inputQuery(mi.Caption, ([[Type Lua code resulting in a boolean value. Function declared as:
function (%s) : boolean]]):format(columns), input)
if not input then return end
local filter = assert(loadstring(("local %s = ...; return "):format(columns) .. input))
-- select the items to remove
local argt = {}
for i = 0, fl.Items.Count-1 do
local item = fl.Items[i]
argt[1] = item.Caption
for j = 1, fl.Columns.Count - 1, 1 do
argt[j+1] = item.SubItems[j-1]
end
item.Selected = filter(table.unpack(argt)) == true
end
--... | (didn't test this)
Also Lua strings are immutable. Successive concatenations make new allocations every time a new string is formed. It's better to use table.concat when possible to let the lower level C API deal with it.
https://stackoverflow.com/a/1407187
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
vovasivy Cheater Reputation: 0
Joined: 09 Jun 2021 Posts: 39
|
Posted: Sun Sep 26, 2021 2:26 pm Post subject: |
|
|
Thank you for responding.
The script was useful, especially until DarkByte added the Lua formula dropout to the search.
With the help of your script, I found many values that I could not find with a standard search.
By the speed of execution, I can say that with the remainder of the number of addresses 10000 or less, it is quite tolerable.
I attach a screen made according to the script that I attached above.(Replaced true with false)
The red border indicates: the applied filter and the execution time. (the number of addresses before applying the filter is 3500)
As for your code, as I have already said, I know programming poorly, but I will try to figure it out.
And thank you again!!!
Description: |
|
Filesize: |
197.9 KB |
Viewed: |
19494 Time(s) |
|
|
|
Back to top |
|
|
vovasivy Cheater Reputation: 0
Joined: 09 Jun 2021 Posts: 39
|
Posted: Mon Sep 27, 2021 1:29 pm Post subject: |
|
|
Thanks.
I used your script to get this (I like it):
Another question.
Is it possible for the results falling under (true) or (false) not to be deleted, but to be hidden or shown at the user's request, as if cut/cancel.
After all, Lua defines this data as a string?
This would greatly facilitate the search. I don't have a strong computer and resource-intensive games take a lot of time to restart and search again with the wrong filter selected.
I am grateful in advance for the answer!!!
Description: |
|
Filesize: |
90.22 KB |
Viewed: |
19452 Time(s) |
|
|
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4300
|
Posted: Mon Sep 27, 2021 1:53 pm Post subject: |
|
|
vovasivy wrote: | Is it possible for the results falling under (true) or (false) not to be deleted, but to be hidden or shown at the user's request, as if cut/cancel. | Not that I know of.
There's no "Hide selected addresses" menu item like there is "Remove selected addresses", and there's no way to undo "Remove selected addresses" I can easily find.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
vovasivy Cheater Reputation: 0
Joined: 09 Jun 2021 Posts: 39
|
Posted: Mon Sep 27, 2021 2:23 pm Post subject: |
|
|
Tell me where you need to click to increase your reputation. I can't find it anywhere.
|
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4300
|
Posted: Mon Sep 27, 2021 4:56 pm Post subject: |
|
|
There's a small thumb up emoji to the right of the reputation number that appears after you reach a certain number of posts.
Don't worry about it. It didn't work last time I checked (something about an sql error IIRC).
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
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
|
|