Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Hazama
Newbie


Joined: 23 Jan 2008
Posts: 2

PostPosted: 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.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: 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
Reply with quote
ralgith
Sorcerer


Joined: 13 Jan 2006
Posts: 715

PostPosted: 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
Reply with quote
Hazama
Newbie


Joined: 23 Jan 2008
Posts: 2

PostPosted: 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.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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