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
qazea
Newbie


Joined: 23 Jun 2001
Posts: 7
Location: USA

PostPosted: Tue Nov 12, 2002 2:11 am   

Text file item file instead of db
 
I have tried getting an alias to show me items with no success, hoping somebody here can help me out.

sample text file:
a glowing sword: 5d5 5hit 5dam
a glowing ring: ac3 5hp
a red ring: ac1 1sv_sp

That's how the text item file is setup. What I would like to be able to do with an alias called id or whatever is display all results in the file via a #SAY command to my current window. So:

> id glowing

would return both the ring and sword

> id ring red

would display the red ring

> id red sword

would not display both the red ring and glowing sword, only display results if it matches ALL keywords given.

I've been toying with this for awhile to no avail, somebody help pretty please? :)

Edit: I am using zmud version 6.16 if that matters.
Reply with quote
cingulli
Wanderer


Joined: 30 Aug 2001
Posts: 53
Location: Finland

PostPosted: Tue Nov 12, 2002 7:47 am   
 
#alias id {#say %grep(2,{%-1})}

Number 2 is the file number.
Reply with quote
qazea
Newbie


Joined: 23 Jun 2001
Posts: 7
Location: USA

PostPosted: Tue Nov 12, 2002 7:22 pm   
 
Hey thanks for the reply, that works but outputs everything into a big paragraph form (each item is seperated by a |) instead of putting each item on it's own line, which isn't exactly easy to read. Didn't account for all keywords either, did an id ring ac3 for example to try and return all rings that have ac3 and it returned nothing.

Any way around these issues?
Reply with quote
cingulli
Wanderer


Joined: 30 Aug 2001
Posts: 53
Location: Finland

PostPosted: Tue Nov 12, 2002 10:11 pm   
 
#alias id {#forall %grep(2,{%-1}) {#show %i}}

id ring? ac3
id glowing * ac3
id a %w sword

check 'Pattern Matching' in zMUD helps
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Tue Nov 12, 2002 11:56 pm   
 
%grep supports pattern matching exactly as triggers do. So in your example to match the line that has the 2 keywords ring and ac3 you could do "ring * ac3". In order to do that automatically would take far more code then is worth.
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