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
Ormarr
Newbie


Joined: 22 Dec 2009
Posts: 1

PostPosted: Tue Dec 22, 2009 11:20 am   

Capture lines with []
 
Greetings,

I tried to capture lines and send them to a different window with the following prefix:

[Abenteuer:Ormarr]

The [] and : are always present, and the text before and after the : changes.

I managed to capture lines before but as soon as it comes to [] I really have a problem to get it going.

If someone could help me out with the right trigger I would appreciate it.

Thank you.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Tue Dec 22, 2009 1:46 pm   
 
A simple trigger pattern of "[*:*]" should match those lines:
Code:
<trigger priority="10" id="1">
  <pattern>[*:*]</pattern>
  <value>#cap mywindow</value>
</trigger>

If you need to specifically capture and use the values before and after the colon, use the pattern "[(*):(*)]".
Reply with quote
shaun.murray
Magician


Joined: 23 Jul 2005
Posts: 334
Location: Chicago

PostPosted: Tue Dec 22, 2009 1:52 pm   
 
Don't you need a ~ before each and every bracket? If not, I have some work to do on my triggers. ^^

Code:
#trig {~[(%w):(%w)~]} {#cap mywindow}
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Tue Dec 22, 2009 1:58 pm   
 
Yes, actually it would be better to put the tilde before the square brackets. Square brackets are used in trigger patterns to specify a range value. However, I did test the pattern I gave, and it works, probably because Cmud recognizes that it cannot be a range value with asterisks inside. But you are correct, it is better to get in the habit of using a tilde, ~, before any square brackets in trigger patterns.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Tue Dec 22, 2009 9:30 pm   
 
Quote:

However, I did test the pattern I gave, and it works, probably because Cmud recognizes that it cannot be a range value with asterisks inside.


You didn't do much testing. ;) As long as it's not more ranges or a stringlist pattern, any wildcard contained in a range will be evaluated as a wildcard. So, basically, [*:*] is the same as [*] which itself is the same as *.
_________________
EDIT: I didn't like my old signature
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed Dec 23, 2009 1:24 pm   
 
Ooops Embarassed Thanks for the correction.
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