|
Numb3r Newbie
Joined: 11 Mar 2007 Posts: 5
|
Posted: 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. |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: 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}} |
|
|
|
Numb3r Newbie
Joined: 11 Mar 2007 Posts: 5
|
Posted: Mon Mar 12, 2007 8:12 pm |
Thank you very much, all works now.
|
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: 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 |
|
|
|
|
|