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


Joined: 02 Aug 2015
Posts: 5

PostPosted: Tue Aug 04, 2015 10:47 am   

Help with pattern matching
 
In the MUD I'm playing (DartMUD), I like to match patterns from the start with the ^ at the beginning because just about all of the output from the MUD that isn't speech is at the beginning of the line. This way I can move the informational patterns to other windows and still get mostly speech in my main window (the mud actually shows speech as "You say in common, 'Hello.'"). My problem comes in that the MUD will toss out a "> " character (note there is a space after > in case it is important) sometimes at the beginning of the line (I don't know why). I cannot figure out how to account for this in my patterns. I've tried %p thinking that "> " might be punctuation, but to no avail.

Basically I want to be able to capture both

^You continue

and

^> You continue

with one trigger rather than having to make another whole set for when this "> " character gets thrown in. What can I use to tell the pattern matcher that the "> " will sometimes be there and sometimes not? I don't want to use * because then speech that might happen contain "You continue" (i.e. "You say in common, 'I am sure I'm right but you continue to defy me.'") will be captured by the pattern as well.

Hope that makes it clear. I'm pretty new to scripting and mostly use the wizard... just so ya know ;)
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Tue Aug 04, 2015 3:41 pm   
 
This will match either "> ", or nothing: {> |}
Or in a regular expression pattern: (?:> )?
Reply with quote
shalimar
GURU


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

PostPosted: Wed Aug 05, 2015 3:54 am   
 
I usually make the following trigger:

Code:
<trigger priority="1" id="promptBeGone">
  <pattern>^> $</pattern>
  <value>#SUB {}</value>
</trigger>
_________________
Discord: Shalimarwildcat
Reply with quote
mumpsdgen
Newbie


Joined: 02 Aug 2015
Posts: 5

PostPosted: Sun Aug 09, 2015 4:04 am   
 
That was what I needed Daern. Thank you! Didn't know about the | to symbolize nothing

Tried yours shalimar but I think it was interferring with a command echo window trigger I have. Thank you anyways though :)
Reply with quote
shalimar
GURU


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

PostPosted: Sun Aug 09, 2015 9:07 am   
 
You likely have to force the priority number to be lower to ensure it will fire before anything else.
That was an XML code snippet, btw.
Also, because of the fact you echo commands (i dont) you might have to change the checkmarks from new line to prompt.
_________________
Discord: Shalimarwildcat
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