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
➜ Multiple line triggers that can slightly vary
Multiple line triggers that can slightly vary
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Tboydston
(14 posts) Bio
|
Date
| Fri 10 Apr 2009 11:28 PM (UTC) |
Message
| I am trying to make a trigger that matches this:
Cutting open the corpse of a Mhun guard, you begin to rummage around the innards
to find an appropriate place to remove the kidneys. Your sharp eye immediately
sees a spot and you excise the lovely organ.
The problem is that the target "Mhun guard" changes and so does the formatting of the three lines. Sometimes the "to find" from the second line is on the first line, and sometimes "rummage" is on the second line. If it all stays in one place, I know how to make this trigger, but I can't make it work with shifting text.
I know I could make quite a few single line triggers that just try to match the variation of the middle line (which is the only line I really need), but I'd rather find a way just to make one trigger that looks for all of those words and doesn't care of the line order.
Here's the XML for me catching one line:
<trigger
enabled="y"
match="^innards to find an appropriate place to remove the (\w*)\. Your sharp eye $"
regexp="y"
script="gotOrgan"
send_to="12"
sequence="100">
</trigger> | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #1 on Sat 11 Apr 2009 01:38 AM (UTC) |
Message
| |
Posted by
| Worstje
Netherlands (899 posts) Bio
|
Date
| Reply #2 on Sat 11 Apr 2009 05:28 AM (UTC) |
Message
| Or, since I am pretty sure you are playing Aetolia... Try the mud command CONFIG WRAPWIDTH 0, and configure MUSHclient to do the wrapping in the Output screen of your Configuration.
This way, the mud won't do any wrapping of its own, making it far easier to trigger things. | Top |
|
Posted by
| Twisol
USA (2,257 posts) Bio
|
Date
| Reply #3 on Sat 11 Apr 2009 07:30 AM (UTC) Amended on Sat 11 Apr 2009 07:31 AM (UTC) by Twisol
|
Message
| If there's no simpler recourse, one technique I've had some success with is to make a "begin" trigger that matches enough of the first line to be sure you have the right one, and an "end" trigger that matches on the prompt (or some other distinctive ending line). A third trigger, ^.*$, would catch everything in between, but be higher in Sequence so it doesn't capture the ending trigger line before it gets shut off.
In the catch-all trigger, you'd append each line to a variable. In the end trigger, you could pass it through gsub or a PCRE pattern, or do whatever else you need to do with it. |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | 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,739 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top