Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ MUSHclient ➜ General ➜ Triggers across lines

Triggers across lines

It is now over 60 days since the last post. This thread is closed.     Refresh page


Pages: 1  2  3  4 

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #45 on Sat 05 Nov 2005 09:19 PM (UTC)

Amended on Sat 05 Nov 2005 09:21 PM (UTC) by Nick Gammon

Message
After a bit of recent testing I found the suggested trigger further up matches too often.

This seems to work better:


<triggers>
  <trigger
   enabled="y"
   lines_to_match="15"
   match="You are carrying:\n(([ ]{5}.*\n)*)\n(?![ ]{5})\z"
   multi_line="y"
   regexp="y"
   send_to="2"
   sequence="100"
  >
  <send>Found %0</send>
  </trigger>
</triggers>


There is an extra \n before the last bit, which forces it to assert that it gets a newline followed by *not* 5 spaces, to signal the end of the inventory.

Test data:



You are carrying:
     a magic mushroom
     a torch
     a dragonskin
     a bag
     recall scroll



Without the \n it matched on each line of inventory.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


148,930 views.

This is page 4, subject is 4 pages long:  [Previous page]  1  2  3  4 

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.