[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Triggers not triggering through line break

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?
(New message)
Subject: Triggers not triggering through line break
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please).
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Posted by Michaelmj11   (11 posts)  [Biography] bio
Date Fri 14 Mar 2008 08:46 PM (UTC)  quote  ]
Message
doh... that's not fair... :{

thanks.
[Go to top] top

Posted by Nick Gammon   Australia  (18,769 posts)  [Biography] bio   Forum Administrator
Date Fri 14 Mar 2008 08:16 PM (UTC)  quote  ]
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
[Go to top] top

Posted by Michaelmj11   (11 posts)  [Biography] bio
Date Fri 14 Mar 2008 04:27 PM (UTC)  quote  ]
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?
[Go to top] top

Posted by Michaelmj11   (11 posts)  [Biography] bio
Date Fri 14 Mar 2008 01:39 PM (UTC)  quote  ]
Message
oh, Yes it did work.

Sorry for not making that clear, and

THANK YOU!
[Go to top] top

Posted by Nick Gammon   Australia  (18,769 posts)  [Biography] bio   Forum Administrator
Date Thu 13 Mar 2008 08:17 PM (UTC)  quote  ]
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
[Go to top] top

Posted by Michaelmj11   (11 posts)  [Biography] bio
Date Thu 13 Mar 2008 01:21 PM (UTC)  quote  ]

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.
"
[Go to top] top

Posted by Shaun Biggs   USA  (644 posts)  [Biography] bio
Date Thu 13 Mar 2008 12:11 AM (UTC)  quote  ]

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.
[Go to top] top

Posted by Nick Gammon   Australia  (18,769 posts)  [Biography] bio   Forum Administrator
Date Wed 12 Mar 2008 10:37 PM (UTC)  quote  ]
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:


You hold  firmly


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
[Go to top] top

Posted by Michaelmj11   (11 posts)  [Biography] bio
Date Wed 12 Mar 2008 09:19 PM (UTC)  quote  ]
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>
[Go to top] top

Posted by Nick Gammon   Australia  (18,769 posts)  [Biography] bio   Forum Administrator
Date Sun 24 Feb 2008 09:06 PM (UTC)  quote  ]
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
[Go to top] top

Posted by Skeric   (4 posts)  [Biography] bio
Date Sun 24 Feb 2008 06:57 PM (UTC)  quote  ]
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.
[Go to top] top

Posted by Skeric   (4 posts)  [Biography] bio
Date Sun 24 Feb 2008 06:50 PM (UTC)  quote  ]
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.
[Go to top] 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.


3,216 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]