Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Kotte
Newbie


Joined: 27 Sep 2006
Posts: 6

PostPosted: Wed Sep 27, 2006 2:56 pm   

To use DB or %grep?
 
I have a textfile with a few hundred entries looking like this:

Roomname - Direction : Hiddenname

Roomname can be several words and I have a trigger setting the roomname to a variable. I load the file with #File 1 "myfile.txt", and use #SHOW %grep( 1, @RoomName) to catch every line containing the roomname. Then I have six triggers that sets the hiddenexit like this: #TR {- North : (%w)$} {#VAR HiddenExitNorth %1} etc. All nice and dandy but a problem occurs whenever a roomname is shorter and triggers lines with longer roomnames containing the short one. E.g. Back of a Valley Cave vs Cave. Would this be easier to solve with a database or has someone got a nice function to help me?
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Wed Sep 27, 2006 5:37 pm   
 
If you provide a more narrowly focused regular expression to %grep, you can eliminate the extraneous results. For example, to find "Cave" and not "Back of a Valley Cave," you would search with %grep(1, "^Cave \-") to anchor the text at beginning and end (assuming the format of your file as you have posted it, of course).
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion 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