 |
MRC Newbie
Joined: 09 Feb 2006 Posts: 4 Location: USA
|
Posted: 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 ) 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! |
|
|
 |
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: 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 |
|
|
 |
MRC Newbie
Joined: 09 Feb 2006 Posts: 4 Location: USA
|
Posted: 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. |
|
|
 |
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: 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 |
|
|
 |
JQuilici Adept
Joined: 21 Sep 2005 Posts: 250 Location: Austin, TX
|
|
_________________ Come visit Mozart Mud...and tell an imm that Aerith sent you! |
|
|
 |
|
|