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
➜ multiline triggers (four lines)
multiline triggers (four lines)
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Archibald
(12 posts) Bio
|
Date
| Sun 19 Aug 2007 08:56 PM (UTC) |
Message
| 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. | Top |
|
Posted by
| Archibald
(12 posts) Bio
|
Date
| Reply #1 on Tue 21 Aug 2007 06:51 AM (UTC) |
Message
| 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. | Top |
|
Posted by
| Shaun Biggs
USA (644 posts) Bio
|
Date
| Reply #2 on Tue 21 Aug 2007 07:48 AM (UTC) |
Message
| 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. |
It is much easier to fight for one's ideals than to live up to them. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #3 on Tue 21 Aug 2007 11:42 AM (UTC) |
Message
|
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? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Archibald
(12 posts) Bio
|
Date
| Reply #4 on Tue 21 Aug 2007 08:34 PM (UTC) |
Message
| 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. | Top |
|
Posted by
| Shaun Biggs
USA (644 posts) Bio
|
Date
| Reply #5 on Tue 21 Aug 2007 09:57 PM (UTC) |
Message
|
"(?: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. |
It is much easier to fight for one's ideals than to live up to them. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #6 on Tue 21 Aug 2007 11:04 PM (UTC) Amended on Tue 21 Aug 2007 11:05 PM (UTC) by Nick Gammon
|
Message
| 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.
|
- 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.
21,963 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top