multiline triggers (four lines)

Posted by Archibald on Sun 19 Aug 2007 08:56 PM — 7 posts, 30,073 views.

#0
Ok this is pretty basic stuff for most of you guys but I've decided to start getting active on these forums because I want to try to make my own Lua-based combat system for the mud I play. What I want to learn here is pretty simple. I want to capture:

(this should be four lines)

A hideous archdemon vomits forth a stream of noxious fluid that strikes
(.*?), coating him with a thick green slime.
A hideous archdemon vomits forth a stream of noxious fluid that strikes
(.*?), coating him with a thick green slime.

I've tinkering with the settings for awhile now, just thought I'd ask over here. Any help is appreciated.
#1
Ack was it something I said?

I want to make a trigger to those four lines. How can I capture them? I find the helpfile unclear. I keep getting "Line breaks not permitted here" when I try to make it.
USA #2
Multiline triggers are a pain in the neck to set up. I personally just make sets of triggers which turn each other on and off at each line. Doing this with a string variable to store all the information works well for me personally, however, I'm sure that there are other people out there who use multiline triggers on a regular basis who would be able to help you here.

Also, if you have your client set to wordwrap at the standard 80 characters, you might just have two lines there. The "A hideous archdemon vomits forth a stream of noxious fluid that strikes" part is 71 characters long. After including the space, you just need 8 characters to trip wordwrap. It's still fully possible to have four lines there though, depending on how the mud server sent that out.
Australia Forum Administrator #3
Quote:

I've tinkering with the settings for awhile now, just thought I'd ask over here.


It is hard to answer vague questions like this. It would help to post the actual trigger you have been working on (see http://mushclient.com/copying), some example output from the MUD, and a clear description of what is happening, and what you expected to happen.

One question that springs to mind is why you are matching on 4 lines when it seems to me you have 2 identical lines, twice.

Also, what do you want to do when it matches?
#4
Well, I have a series of four line triggers I want to match. I want to capture both identical lines because although they may seem identical, when both lines hit at the same time something very different happens that just one line hitting. All I plan on doing with the trigger is making a colournote warning. I'm having no problems on that front. I was hoping once I figure out how to do this I could trigger other four-line messages that are similar?

Oh and Shaun, it's definitely four lines. I don't think I could make multiple triggers that trigger themselves with a string variable if the message I'm trying to capture has two identical lines, twice. Or could I?

If someone can help me with how to properly set up four-line triggers in the edit trigger "match" text box I'd be greatly appreciative.
USA #5

"(?:A hideous archdemon vomits forth a stream of noxious fluid that strikes\n(.*), coating him with a thick green slime.\n){2}\Z"

That should match both pairs, with the targets being %1 and %2. I think... again, I've never been good with multiline triggers.
Australia Forum Administrator #6
I gather that both (pairs of) lines should be identical? In which case you need to make sure that the target of the spell is the both in each case. This will do that:


<triggers>
  <trigger
   enabled="y"
   lines_to_match="4"


match="A hideous archdemon vomits forth a stream of noxious fluid that strikes\n(.*), coating him with a thick green slime.\nA hideous archdemon vomits forth a stream of noxious fluid that strikes\n\1, coating him with a thick green slime.\Z"


   multi_line="y"
   regexp="y"
   send_to="2"
   sequence="100"
  >
  <send>%0</send>
  </trigger>
</triggers>


This example works on your test data, eg.


A hideous archdemon vomits forth a stream of noxious fluid that strikes
Nick, coating him with a thick green slime.
A hideous archdemon vomits forth a stream of noxious fluid that strikes
Nick, coating him with a thick green slime.


The \1 in the middle means "match on the first wildcard", which means that it only matches if both names (Nick in my example) are the same - if that is what you intended.