|
mverrilli Newbie
Joined: 15 Nov 2003 Posts: 8
|
Posted: 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. |
|
_________________ |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: 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)
} |
|
|
|
mverrilli Newbie
Joined: 15 Nov 2003 Posts: 8
|
Posted: 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.
|
|
_________________ |
|
|
|
|
|
|
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
|
|