Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
brennanyoung
Newbie


Joined: 17 Jan 2009
Posts: 7

PostPosted: Thu Jan 22, 2009 12:24 am   

Trigger patterns containing linebreaks not working? (2.37)
 
First - thanks much to those who answered my previous posts. Great and welcoming community here.

I know my way around a regex,and have been programming for years, but I just can't seem to get any triggers to work if the pattern contains linebreaks.

Example text from mud which I want to use (ignore quotes):

"cat dog fish.
The door is shut."

I've tried various combinations of $ and ^ and \n and \r and even \l with or without the regex checkbox checked, with no luck.

What am I doing wrong?

Very annoying that the 'test' feature only allows single lines of test data.

This is version 2.37
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4691
Location: Pensacola, FL, USA

PostPosted: Thu Jan 22, 2009 3:20 am   
 
if you highlight the mud text from your window it should automatically copy the linebreak as well, just open settings editor and paste it into the trigger pattern
_________________
Discord: Shalimarwildcat
Reply with quote
chris-74269
Magician


Joined: 23 Nov 2004
Posts: 364

PostPosted: Thu Jan 22, 2009 3:34 am   
 
Did you try taking off the "trigger on newline" parameter? Thay may be causing it to look for 2 linefeeds instead of one, also post the pattern you are using atm
Reply with quote
brennanyoung
Newbie


Joined: 17 Jan 2009
Posts: 7

PostPosted: Thu Jan 22, 2009 4:15 pm   
 
Thanks for your replies.

I tried copying+pasting from the mud output and it's:

but who were we?
The door is shut.

which comes out as:

but who were we?$The door is shut.$

I also tried with and without the newline checkbox. No joy with either. Mysterious.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Fri Jan 23, 2009 2:41 pm   
 
Quote:
but who were we?$The door is shut.$

That is how it probably should come out. I take it this did not actually work for you? Perhaps it would help if you would give a little more detail about what you are trying to do. Multiline triggers should work, but I don't usually use them myself so I don't have experience to help figure that out. But if you can't get that working, there may be other ways to accomplish your goal (though I agree it would be good to figure out the problem here).
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Fri Jan 23, 2009 9:42 pm   
 
I'm going to assume you are using regex patterns for your text. So you'll want a trigger like this.

Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <trigger priority="10" regex="true" copy="yes">
    <pattern>but who were we\?\nThe door is shut.</pattern>
    <value>#echo it called</value>
  </trigger>
</cmud>


I'm assuming one of two things were happening. You weren't escaping the '?' character. But since you said you already regex I'm going to assuming that's not it. Using a regex pattern the '\n' is all you need to indicate a line break.

Since you already told CMUD you want to trigger on line break (the default) you only need to specify the first one since it delimit it's match pattern based on the second line break.

I hope that helps.

I did come across (and reported) a small bug where CMUD would eat the first word of the pattern (or at least indicate it would on it's equivalent perl regex) if you used you used the zScript matching syntax and tried to match the new line.

This pattern
Code:
 but who were we~?$^The door is shut.

would yield this perl regex when checked on the trigger tester tab.
Code:
 but who were we\?\n door is shut\.
_________________
Asati di tempari!
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Sat Jan 24, 2009 10:51 pm   
 
If you're trying to match two lines, use a multistate "within lines" trigger.

#trig {but who were we~} {}
#cond {The door is shut} {whatever} {within|param=1}
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net