About Us
Products
Purchase
Downloads
Support
Forums
Contact Us
Site
 Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
ReedN
Wizard


Joined: 04 Jan 2006
Posts: 1279
Location: Portland, Oregon

PostPosted: Sat Apr 04, 2009 4:46 pm   

[3.05] Feature Request: Regular expression search in the Package Editor
 
I absolutely love the find feature in the package editor. I live by it, using it all the time in editing my scripts. (Just to clarify I'm speaking of the one that searches through all triggers, not the individual window find feature)

One feature I'd love to see added to it is an option to search for a regular expression. I'm always searching for items and wishing I could use regular expressions to hone my search further. I've noticed you have regular expression search in the editor. Would it be possible to add it to the main Package Editor find as well?
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Mon Apr 06, 2009 6:49 pm   
 
Unfortunately, that is very difficult. The current search feature is implemented with a database SQL "LIKE" query and filter. The database I'm using internally doesn't support regular expression filters.

Since the text search feature (Edit/Find) *does* support regular expressions, you might want to select the main window or module and then click the XML tab and then use the text search feature to do what you want.
Reply with quote
ReedN
Wizard


Joined: 04 Jan 2006
Posts: 1279
Location: Portland, Oregon

PostPosted: Mon Apr 13, 2009 4:53 am   
 
I selected the main module (root item in the package editor) and switched it to xml. About 8 seconds later the processing was done and it displayed the xml. Then I tried to bring up the find dialog box but find wouldn't come up.

So the big issues with your suggestion:

1) My package is large enough that there is a very noticeable lag between selecting the module and going into xml mode (~8 sec on a decent computer with 3 GB of memory).
2) Find doesn't work on the root module. I'd have to go individually into each of my 25 sub-classes and search each one separately.
3) Searching through the xml doesn't give the same level of ease of navigation and editing that using the main window search gives.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Mon Apr 13, 2009 5:19 pm   
 
Sorry that was all I could suggest. As I said, it is unlikely that I'll be able to add any regex support to the filter dialog since the database doesn't support it. Your only other option is to export the XML and open it in an editor that can handle the size of the file and the searching.

You could probably also write a Lua script that loops through all of your settings and looks for a regex match. Maybe someone else can help with the start of a Lua script to do this.
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Tue Apr 14, 2009 10:56 pm   
 
That is what I do too Reed. I just export to XML then use Notepad++ and can search regex, replace, or whatever I want. It's simpler than creating an Lua script, but hey if you got the time! Laughing
Reply with quote
ReedN
Wizard


Joined: 04 Jan 2006
Posts: 1279
Location: Portland, Oregon

PostPosted: Wed Apr 15, 2009 4:44 am   
 
Do you then reimport every time you make an edit? That sounds tedious.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Wed Apr 15, 2009 12:30 pm   
 
Only the things that were actually changed, I'd guess.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
ReedN
Wizard


Joined: 04 Jan 2006
Posts: 1279
Location: Portland, Oregon

PostPosted: Wed Apr 15, 2009 2:03 pm   
 
Would anyone care to give me a few hints on how the Lua search might be done?
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Wed Apr 15, 2009 4:18 pm   
 
Well firstly, Lua doesn't support regex by default, so you'll want to get a PCRE library for it. I linked one back in the "Getting Lua to work in CMUD (or zMUD!)" thread from before Lua was native in CMUD, so that might be a place to start.

Then you'll want to use a loop from 1 to zs.numalias (or whatever) using zs.getalias(i) to return each alias. You can then check whatever property you want and change it. Repeat for any other setting types you want to look through.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Wed Apr 15, 2009 5:30 pm   
 
You could probably even do it within normal zScript using the %sess.numalias and %sess.getalias COM functions. Then you can use %match to do a regex match, and once you find the name of the setting to edit, then you can use the #EDIT command to open the settings editor for the one you found.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Thu Apr 16, 2009 10:45 am   
 
I made a post some time back, in the CMud General Forum that used Lua and %subregex on settings. You should be able to dig it up and have a pretty good idea how to modify it for your needs.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
ReedN
Wizard


Joined: 04 Jan 2006
Posts: 1279
Location: Portland, Oregon

PostPosted: Thu Apr 16, 2009 2:28 pm   
 
http://forums.zuggsoft.com/forums/viewtopic.php?t=31221&highlight=

This one? Did it ever get added to the toolbox? I didn't see it mentioned in the shared library.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Apr 17, 2009 10:17 am   
 
That would be the script. I never did put it into the toolbox. If you hadn't guessed many other things are going on in my life and I haven't been able to spend any time with CMud for a while.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum All times are GMT
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

© 2009 Zugg Software. Hosted by Wolfpaw.net