Multi Line Trigger

Posted by Mudletusr on Mon 01 Apr 2024 12:10 PM — 4 posts, 8,719 views.

#0
Hi I"m trying to get this small multi line trigger working thanks. I want to match the last word of the second line.

Right here you (.*)$(.*)(\w+).*\z

For example:

Right here you see:
- The rabbit
- A field mouse

Should match rabbit but isn't outputting what I want. I use this:

say 'k %1 %2 aaaaaaaaaaaaa'
say 'k %1 %2 bbbbbbbbbbbb'

thanks
Australia Forum Administrator #1
Can you show the actual trigger please? See this:

Template:copying
For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.


Quote:

Should match rabbit but isn't outputting what I want.


What is it outputting?
Australia Forum Administrator #2
Try this:


<triggers>
  <trigger
   enabled="y"
   lines_to_match="2"
   match="Right here you (.*)\n(?:.*)\s+(\w+)\Z"
   multi_line="y"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>
print ("%%1 = %1")
print ("%%2 = %2")
  </send>
  </trigger>
</triggers>


Template:pasting
For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.
Amended on Tue 02 Apr 2024 02:47 AM by Nick Gammon
#3
That worked thanks a lot!