|
fhqwhgad Novice
Joined: 07 Feb 2005 Posts: 38
|
Posted: Wed Dec 12, 2007 10:13 am
trigger patterns |
This is what i want to trigger on:
Fhqwhgad tells you 'hello there'
My trigger looks like this: %w tells you '*'
It works great and all, however it isn't as picky as i'd like. It triggers even if something is infront of the %w which i would like it not to.
Example: The Fhqwhgad tells you 'hello there'
Basically i want it to trigger when there's only 1 word before the tells you. |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Wed Dec 12, 2007 11:24 am |
This process is sometimes called anchoring. The ^ character matches the start of the line, so ^hello in a trigger will only match the world "hello" when it's at the beginning of the line. Similarly, $ matches the end of the line.
Your new trigger pattern will be ^%w tells you '*'
For more info on pattern-matching, see the help. |
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Wed Dec 12, 2007 2:11 pm |
This can however miss some things when they appear AFTER your prompt (due to repeated command inputs and such).
|
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Thu Dec 13, 2007 12:00 am |
One workaround, which is really only possible if there is no chance of extra wordage in front of or behind a player name, is the following:
#trigger {^(*) tells you, '*'$} {#if (%numwords(%1) = 1) {#noop this is a valid tell from a player} {#noop this is an invalid tell}} |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
|
|