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


Joined: 15 Nov 2003
Posts: 8

PostPosted: Sun Jun 12, 2005 2:16 pm   

Regex help? Trying to parse exits...
 
Here is an example line:

Obvious exits are south, up, west and east.

I'm trying to make it so that %1 = south, %2 = up, ...

The exits can be anything, not just north, south, east, west, etc.
And the number of exits can change (obviously).

I can do this with multiple triggers (one for every exit number). But I am sure this can be done in a single regular expression, but it is escaping me.

Any ideas? I tried searching the forum, but I had no luck.
_________________
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Sun Jun 12, 2005 6:53 pm   
 
It can also be done with a simple zmud trigger, well it wont make them %1...%2 you can use %item to use them

#TRIGGER "exits" {Obvious exits are (*).} {
#VAR Exits {%replace(%replace("%1"," and ","|"),", ","|")}
#SAY first exit is %item(@exits,1)
}
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
mverrilli
Newbie


Joined: 15 Nov 2003
Posts: 8

PostPosted: Sun Jun 12, 2005 7:10 pm   
 
Oh, very clever, thank you. That will do. I'm making a trigger to assign the first irregular exit to a keypad key, like /. So everytime you enter a room, it parses that exits, finds the first one that isn't n, s, e, w.... etc.
_________________
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