 |
Hazama Newbie
Joined: 23 Jan 2008 Posts: 2
|
Posted: Wed Jan 23, 2008 2:04 am
Recognizing and ignoring extra characters |
Hello there. Hopefully someone can aid me or point me in the right direction.
I'm looking to create a trigger that fires when CMUD receives "You disappear into the Void." and returns "whistle self". I can do this myself. However, it responds when people say this line as well. I'm looking for a way to create a trigger that recognizes the real void message and firing and recognizing a fake message and either not doing anything or perhaps slapping the person who did it. |
|
|
 |
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Wed Jan 23, 2008 4:04 am |
Make use of the ^ and the $ characters in your trigger pattern.
^ - matches to the start of the line
$ - matches to the end of the line
^You disappear into the Void.$ <--completely prevents you from responding at all, because your trigger will no longer match the faked lines.
If you really want to match on all the fakes as well, try this out:
#trigger {(*)You disappear into the Void.(*)} {this trigger is for faked void messages}
That, of course, is untested. It obviously will match on the faked lines, but it might also match on the real line and so %1 and %2 will both contain nothing. If that's the case, you'll need to use an #IF command to check the value or null status of each variable to make sure it's not the real deal.
#if (%null(%1) and %null(%2)) {real message} {faked or mismatched message} |
|
_________________ EDIT: I didn't like my old signature |
|
|
 |
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Wed Jan 23, 2008 4:05 am |
Prepend a ^ to the pattern, as in "^You disappear into the Void."
That special character makes it only match the pattern if it appears on a new line. As it would when sent from the MUD, but not when someone chats or says or emotes it etc etc. |
|
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
 |
Hazama Newbie
Joined: 23 Jan 2008 Posts: 2
|
Posted: Wed Jan 23, 2008 7:00 am |
Thank you so much. I probably could have figured that out myself if I'd looked further. I found the $ character for the end, which stopped responding to the trigger phrase being said (due to speech ending in a single quote) but failed to prevent it being triggered through emotes. I hadn't stumbled upon the ^, but now it's working perfectly.
|
|
|
 |
|
|