|
mumpsdgen Newbie
Joined: 02 Aug 2015 Posts: 5
|
Posted: 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 ;) |
|
|
|
Daern Sorcerer
Joined: 15 Apr 2011 Posts: 809
|
Posted: Tue Aug 04, 2015 3:41 pm |
This will match either "> ", or nothing: {> |}
Or in a regular expression pattern: (?:> )? |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4691 Location: Pensacola, FL, USA
|
Posted: 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 |
|
|
|
mumpsdgen Newbie
Joined: 02 Aug 2015 Posts: 5
|
Posted: 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 :) |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4691 Location: Pensacola, FL, USA
|
Posted: 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 |
|
|
|
|
|