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
➜ Triggers not triggering through line break
Triggers not triggering through line break
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Skeric
(4 posts) Bio
|
Date
| Sun 24 Feb 2008 06:50 PM (UTC) |
Message
| Hey all, i'm trying to do a Note trigger. Basicly it's like
Trigger:
*summons up an evil tide of unholy power which engulfs you*
Send: Note ("[FIRE] **APPLY MENDING")
Send to Script
However in the MUD, the trigger message has a line break in it. It's going like
So-and-so summons up an evil tide of unholy power which engulfs you.
The trigger message is all one line, so the message that wraps to the next line doesn't trigger it.
How do I go about telling the trigger line to go onto the next line as well, so that message that goes 2 lines long, triggers that trigger?
-thanks in advance. | Top |
|
Posted by
| Skeric
(4 posts) Bio
|
Date
| Reply #1 on Sun 24 Feb 2008 06:57 PM (UTC) |
Message
| Sorry. the line
So-and-so summons up an evil tide of unholy power which engulfs you.
Should read
So-and-so summons up an evil tide of unholy power
which engulfs you. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #2 on Sun 24 Feb 2008 09:06 PM (UTC) |
Message
| Does the line break always occur at the same place? If so, make a multi-line trigger (number of lines = 2) and put \n at the place where the line break is. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Michaelmj11
(11 posts) Bio
|
Date
| Reply #3 on Wed 12 Mar 2008 09:19 PM (UTC) |
Message
| I am having a similar problem except that the \n does not seam to be correcting it.... i am trying to have this as the Match= section
"
You hold a wooden sword firmly, and start spinning round...
You feel dizzy, and a tiny bit embarassed.
"
more specifically I want it to catch on something like this:
"
*You hold*firmly, and start spinning round...
You feel dizzy, and a tiny bit embarassed.
"
i have tried a couple different things and none seams to want to work... here they are.
1st try:
<triggers>
<trigger
enabled="y"
lines_to_match="2"
match="You hold a wooden sword firmly, and start spinning round...\nYou feel dizzy, and a tiny bit embarassed."
multi_line="y"
regexp="y"
sequence="1"
>
</trigger>
</triggers>
2nd Try:
<triggers>
<trigger
enabled="y"
lines_to_match="2"
match="You hold*firmly, and start spinning round...\n*You feel dizzy, and a tiny bit embarassed."
multi_line="y"
regexp="y"
sequence="1"
>
</trigger>
</triggers>
3rd Try:
<triggers>
<trigger
enabled="y"
lines_to_match="2"
match="You hold a wooden sword firmly, and start spinning round...(\n)You feel dizzy, and a tiny bit embarassed."
multi_line="y"
regexp="y"
sequence="1"
>
</trigger>
</triggers>
| Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #4 on Wed 12 Mar 2008 10:37 PM (UTC) |
Message
| Can you please post the MUD output that this is trying to match?
I can see a couple of problems here. With regular expressions active, to match a period you actually need to escape it, like this: \.
Also this is not right:
You hold*firmly
With regular expressions the * means to match zero or more of the previous character, thus that would match:
You holfirmly
You holdfirmly
You holddfirmly
You holdddfirmly
However none of those are probably what you want. A "match anything" field with regular expressions is .*, in other words:
You hold .* firmly
However as * matches zero or more, that would actually match:
Note two spaces between "hold" and "firmly".
Also, to make it be returned as a wildcard you need to put the item into brackets. A closer thing would be:
You hold (.+) firmly
The "+" says one or more, so you must have something there, and the brackets mean it becomes a wildcard which is returned to the trigger.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Shaun Biggs
USA (644 posts) Bio
|
Date
| Reply #5 on Thu 13 Mar 2008 12:11 AM (UTC) Amended on Thu 13 Mar 2008 12:12 AM (UTC) by Shaun Biggs
|
Message
| Also, the periods will match funny. This line should be changed:
match="You hold (.+), and start spinning round\.\.\.\nYou feel dizzy, and a tiny bit embarassed\."
|
It is much easier to fight for one's ideals than to live up to them. | Top |
|
Posted by
| Michaelmj11
(11 posts) Bio
|
Date
| Reply #6 on Thu 13 Mar 2008 01:21 PM (UTC) Amended on Thu 13 Mar 2008 01:22 PM (UTC) by Michaelmj11
|
Message
| thanks, that helped a lot.
and sorry about not being more clear, but this is the output i am trying to match to.
"
You hold a wooden sword firmly, and start spinning round...
You feel dizzy, and a tiny bit embarassed.
" | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #7 on Thu 13 Mar 2008 08:17 PM (UTC) |
Message
| Well does it work now? When I tested Shaun's suggested match, it fired for me:
<triggers>
<trigger
enabled="y"
lines_to_match="2"
match="You hold (.+), and start spinning round\.\.\.\nYou feel dizzy, and a tiny bit embarassed\."
multi_line="y"
regexp="y"
send_to="12"
sequence="1"
>
<send>print "Trigger fired"</send>
</trigger>
</triggers>
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Michaelmj11
(11 posts) Bio
|
Date
| Reply #8 on Fri 14 Mar 2008 01:39 PM (UTC) |
Message
| oh, Yes it did work.
Sorry for not making that clear, and
THANK YOU! | Top |
|
Posted by
| Michaelmj11
(11 posts) Bio
|
Date
| Reply #9 on Fri 14 Mar 2008 04:27 PM (UTC) |
Message
| here is another question that relates to some of what you were saying about the wildcard (.+).
i have this exit that works marvelously.
<triggers>
<trigger
enabled="y"
match="[Exits:*(D)* (D)* (D)* (D)* (D)*]"
sequence="66"
>
<send>open %2
open %3
open %4
open %5
open %6</send>
</trigger>
</triggers>
i am trying to make one that is multi line, but that will follow a thief/pickpocket when it flees.
the actuall Mud Output is:
"
A thief leaves north.
A thief has fled.
"
i have tried a couple things that i was hoping would work, but to no avail, here they are:
#1;
<triggers>
<trigger
enabled="y"
group="chasing"
match="A thief leaves .*\.\nA thief has fled\."
regexp="y"
sequence="41"
>
<send>%1</send>
</trigger>
</triggers>
and #2;
<triggers>
<trigger
enabled="y"
match="A thief leaves (.+)\.\nA thief has fled."
regexp="y"
sequence="42"
>
<send>%1</send>
</trigger>
</triggers>
any suggestions?
| Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #10 on Fri 14 Mar 2008 08:16 PM (UTC) |
Message
| You didn't enable multi-line, thus it tries to match on a single line. Try this:
<triggers>
<trigger
enabled="y"
lines_to_match="2"
match="A thief leaves (.+)\.\nA thief has fled."
multi_line="y"
regexp="y"
sequence="42"
>
<send>%1</send>
</trigger>
</triggers>
That worked for me. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Michaelmj11
(11 posts) Bio
|
Date
| Reply #11 on Fri 14 Mar 2008 08:46 PM (UTC) |
Message
| doh... that's not fair... :{
thanks. | 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.
29,434 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top