|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
catfood Cheater Reputation: 0
Joined: 22 Jun 2015 Posts: 34
|
Posted: Mon Apr 10, 2017 9:36 pm Post subject: add "Search" box to CE? |
|
|
Hello, I have a pretty beefy table, and my organisation skills are messy, i spend a lot of time searching for where i put a script, or hack.
Is there any way to add a search box, so i can search for script names with a click or a Ctrl+F?
i believe this should be possible with some Lua magic, right?
Thanks very much!
EDIT:
i found this older video with dead links of someone showing off such a thing
https://www.youtube.com/watch?v=eU0wDU7viNo
|
|
Back to top |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Tue Apr 11, 2017 3:06 pm Post subject: |
|
|
Sure, it's possible. Code: | local addressList = getAddressList()
local search = "Description"
for i = 0, addressList.Count - 1 do
local record = addressList.MemoryRecord[i]
if record.Description:find(search) then
addressList.setSelectedRecord(record)
break
end
end |
I'm not seeing any direct "Parent" property, so you may have to manually find its parent and determine if you need to expand it.
Maybe post a request here to develop an extension:
http://forum.cheatengine.org/viewtopic.php?p=5683020
|
|
Back to top |
|
|
catfood Cheater Reputation: 0
Joined: 22 Jun 2015 Posts: 34
|
Posted: Tue Apr 11, 2017 10:38 pm Post subject: |
|
|
[quote="Zanzer"]Sure, it's possible.[code]local addressList = getAddressList()
local search = "Description"
for i = 0, addressList.Count - 1 do
local record = addressList.MemoryRecord[i]
if record.Description:find(search) then
addressList.setSelectedRecord(record)
break
end
end[/code]
I'm not seeing any direct "Parent" property, so you may have to manually find its parent and determine if you need to expand it.
Maybe post a request here to develop an extension:
http://forum.cheatengine.org/viewtopic.php?p=5683020[/quote]
i just played with this, and this would work perfect for my needs, is there a way to make this a little more accessibly tho? so i dont have to open up and change a script each time to do a search?
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Wed Apr 12, 2017 3:52 am Post subject: |
|
|
Code: |
if (fd==nil) then
fd=createFindDialog()
fd.Options="[frDown, frHideEntireScope, frHideUpDown, frHideWholeWord, frHideMatchCase]"
fd.OnFind=function(fd)
local addressList = getAddressList()
local search = fd.FindText
local startindex=0
if addressList.SelectedRecord~=nil then
startindex=addressList.SelectedRecord.Index+1
end
for i = startindex, addressList.Count - 1 do
local record = addressList.MemoryRecord[i]
if record.Description:find(search) then
addressList.setSelectedRecord(record)
break
end
end
end
end
pm=getAddressList().Popupmenu
mi=createMenuItem(pm)
mi.Caption="Find"
mi.Shortcut="Ctrl+F"
mi.OnClick=function()
fd.Execute()
end
pm.Items.insert(0,mi)
|
_________________
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 |
|
|
catfood Cheater Reputation: 0
Joined: 22 Jun 2015 Posts: 34
|
Posted: Wed Apr 12, 2017 5:43 am Post subject: |
|
|
YES!!! this is exactly what i was looking for!!!, thank you so much!
is there a way to make it non case sensitive, and search both up and down? (currently only searches down)
|
|
Back to top |
|
|
Merlini Advanced Cheater Reputation: 2
Joined: 12 Jun 2016 Posts: 53
|
Posted: Wed Apr 12, 2017 6:38 am Post subject: |
|
|
Try this:
Prepend your search term with a minus sign to search backward.
Will also loop over to the other side of the ring when top or bottom
of the list has been reached.
e.g. search "asdf" to search forward "-asdf" to search backward.
Code: | function doSearch(search, currentindex, addressList, direction, firstpass)
local count = addressList.Count
if (direction == -1) then
search = string.sub(search, 2, -1)
if (firstpass == 1) then
startindex = currentindex-1
endindex = 0
else
startindex = count-1
endindex = currentindex+1
end
else
if (firstpass == 1) then
startindex = currentindex+1
endindex = count-1
else
startindex = 0
endindex = currentindex-1
end
end
for i = startindex, endindex, direction do
local record = addressList.MemoryRecord[i]
if string.find( string.upper(record.Description), string.upper(search) ) then
return record
end
end
return nil
end
if (fd==nil) then
fd=createFindDialog()
fd.Options="[frDown, frHideEntireScope, frHideUpDown, frHideWholeWord, frHideMatchCase]"
fd.OnFind=function(fd)
local addressList = getAddressList()
local search = fd.FindText
local currentindex = 0
local direction = (string.sub(search, 1, 1) ~= '-') and 1 or -1
if (addressList.SelectedRecord ~= nil) then
currentindex=addressList.SelectedRecord.Index
end
local recordFound = doSearch(search, currentindex, addressList, direction, 1)
if (recordFound == nil) then
recordFound = doSearch(search, currentindex, addressList, direction, 0)
end
if (recordFound ~= nil) then
addressList.setSelectedRecord(recordFound)
end
end
pm=getAddressList().Popupmenu
mi=createMenuItem(pm)
mi.Caption="Find"
mi.Shortcut="Ctrl+F"
mi.OnClick=function()
fd.Execute()
end
pm.Items.insert(0,mi)
end
|
---
Please note that I've coded less than 50 lines of LUA prior to this, so
take the code with a grain of salt. I'm not even sure if I can leave
that second part as a naked script. Maybe I have to wrap that in a
"main()" looking wrapper for it to be kosher?
It seems to work on my end but I can't be sure. :shrug:
|
|
Back to top |
|
|
catfood Cheater Reputation: 0
Joined: 22 Jun 2015 Posts: 34
|
Posted: Wed Apr 12, 2017 11:45 am Post subject: |
|
|
this is awesome Merlini! thanks for this!! it also works without the - to search in both directions
|
|
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
|
|