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.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ Multi-line trigger problem

Multi-line trigger problem

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


Posted by Obby   (2 posts)  Bio
Date Tue 13 Oct 2015 07:15 PM (UTC)

Amended on Tue 13 Oct 2015 08:00 PM (UTC) by Nick Gammon

Message
Hi all,

Trying to write a trigger that will fire on a room output, will start with a short desc in [] and then up to 4 new lines, then a line with exits, then a line with the people/npcs in the room.

I need it to fire only in this circumstance, as scrying a room will output the same exits/people there, hence all the extra complication.

At the moment I have:


  <trigger
   enabled="y"
   expand_variables="y"
   keep_evaluating="y"
   match="^\[(.*)\](\n(.*)){0,8}\nThere (is|are)(.*) obvious exits?(.*)\n(?P<followers>.*)\.$"
   regexp="y"
   send_to="12"
   sequence="100"
   multi_line="y"
  >


The room output looks like this:


[Room Short Desc with map below]
      |   
      *   
     /|\  
    @     
   /      
 -$       
  |       
Room Description Here.
Possible weather line.
Possible other newline(s).
There are two obvious exits: northeast and southwest.
Person One, Person Two, Person Three, Person 4 and Person 5 are standing here.



I guess I could try and do a negative lookback on the lines that preclude scrying but that'd be just as complicated :) Any help would be appreciated!

Oh and I'm pretty new to writing regexp, so there may be a lot of newbie errors in that.. I had it working for just the two lines but having trouble extending it to work as I want it to.

-Obby
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Tue 13 Oct 2015 08:02 PM (UTC)
Message
I tend to steer away from multi-line single triggers for complex situations because it is hard to get them to fire properly. If you make them match too few lines they might miss something, and if you make them match too many you might get double hits.

Template:faq=37 Please read the MUSHclient FAQ - point 37.


I would be going down that path. Detect the start of a room name, skip the map with a second trigger, and so on. I think I used something similar for one of the mapper versions I did.

- Nick Gammon

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

Posted by Obby   (2 posts)  Bio
Date Reply #2 on Tue 13 Oct 2015 08:07 PM (UTC)
Message
Aha that's quite a lot easier, I'll get on that!

Thanks for the prompt reply, and for all your work on this awesome client :)

-Obby
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.


13,453 views.

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.