Triggers not triggering through line break

Posted by Skeric on Sun 24 Feb 2008 06:50 PM — 12 posts, 41,009 views.

#0
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.
#1
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.
Australia Forum Administrator #2
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.
#3
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>
Australia Forum Administrator #4
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.
USA #5
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\."
Amended on Thu 13 Mar 2008 12:12 AM by Shaun Biggs
#6
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.
"
Amended on Thu 13 Mar 2008 01:22 PM by Michaelmj11
Australia Forum Administrator #7
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>
#8
oh, Yes it did work.

Sorry for not making that clear, and

THANK YOU!
#9
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?
Australia Forum Administrator #10
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.
#11
doh... that's not fair... :{

thanks.