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


Joined: 11 Mar 2007
Posts: 5

PostPosted: Mon Mar 12, 2007 7:25 pm   

Triggering single characters.
 
Can anyone point me in the right direction if I want to trigger to 1 character, but only if it's shown alone and not part of a word?

For example...

Code:
#TRIGGER {n} {#ADD ndir 1}

Except that causes problems by being set off by other text, and adds all the n's in a room description to @ndir.
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Mon Mar 12, 2007 7:59 pm   
 
You can either use the regex "\bn\b" - \b representing a word boundary - or use the normal trigger " n ". The other thing you could try is a multistate trigger, or only activating the trigger once a keyword has been received (like "exit" or "obvious exit"). Another thing you could try if all the exits are on one line and that's what you want to capture is something like this:

#trig {There are %w obvious exits: (*)} {#if (%pos(n,%1)) {#add ndir 1}}
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Numb3r
Newbie


Joined: 11 Mar 2007
Posts: 5

PostPosted: Mon Mar 12, 2007 8:12 pm   
 
Thank you very much, all works now.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Mon Mar 12, 2007 8:44 pm   
 
Look into the use of %q. It's very similar or the same as the regex /b that Fang mentioned.
_________________
EDIT: I didn't like my old signature
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