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


Joined: 09 Feb 2006
Posts: 4
Location: USA

PostPosted: Thu Feb 09, 2006 5:24 am   

matching a blank line in a conditional trigger?
 
I capture my mud's various chat lines and send them to child windows. Usually (but not always) the chat is followed by a blank line. The blank line does not contain any spaces - it's just a crlf (or maybe a lf... not really sure how to tell the difference Wink ) The trigger below matches the text, puts it in my "Shout" window, and gags it in my main window, but the blank line after the chat still causes a line feed in the main window. Is there a way to match and gag the linefeed after the chat?

Here's the trigger:

#REGEX {^(?:>\s)?(\w+) shouts:(.*)$} {#GAG;:Shout:#SAYPROMPT {%ansi( bold, cyan)%1": "%ansi( bold, grey)%2}} "Chat Triggers"
#COND {^ +(.*)$} {#GAG;:Shout:#SAYPROMPT {%ansi( bold, grey)" "%1}} {looppat|prompt|regex}

Here's an example of something that matches. (The multiple lines is how my mud formats it and the reason for the #COND in the trigger. The periods at the beginning of the second line are spaces on the mud. I just couldn't get spaces to format correctly in this message.):

MRC shouts: Hey - Can anyone help me with this
. . . . . . . . . . trigger?
<blank line here>

Thanks!
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Thu Feb 09, 2006 10:41 pm   
 
The blank line can be matched with either ^$ or $ (one of them does not work within #CONDITION even though it works in a normal single-state trigger). I'd include it as a WithinLines=1 condition. The WithinLines option would invalidate the condition once the next line of text came in, thereby resetting the multi-state trigger back to state 0 automatically (if there happened to be more states after the blank line, it'd cycle to the next one).
_________________
EDIT: I didn't like my old signature
Reply with quote
MRC
Newbie


Joined: 09 Feb 2006
Posts: 4
Location: USA

PostPosted: Thu Feb 16, 2006 4:51 pm   
 
Thanks - that worked perfectly.

Here's the new trigger in case anyone else finds it useful.

#REGEX {^(?:>\s)?(\w+) shouts:(.*)$} {#GAG;:Shout:#SAYPROMPT %ansi( bold, cyan)%1": "%ansi( bold, grey)%2}} "Chat Triggers"
#COND {^ +(.*)\n?$} {#GAG;:Shout:#SAYPROMPT {%ansi( bold, grey)" "%1}} {looppat|prompt|regex}
#COND {^$} {#GAG} {within|param=1}

Are the various trigger options (like withinlines, looppat, etc) documented somewhere? I'd like to figure out exactly how they all work, but couldn't find them in the online docs anywhere.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Thu Feb 16, 2006 10:55 pm   
 
yeah, they are in there. If I recall, you can reach them via a hyperlink in the helpfile for #TRIGGER. In the syntax line the word "Options" is hyperlinked.
_________________
EDIT: I didn't like my old signature
Reply with quote
JQuilici
Adept


Joined: 21 Sep 2005
Posts: 250
Location: Austin, TX

PostPosted: Fri Feb 17, 2006 12:21 am   
 
Also see the Advanced Triggers article from the ZMud library, which explains 'em in more detail.
_________________
Come visit Mozart Mud...and tell an imm that Aerith sent you!
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