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
mose
Novice


Joined: 02 Dec 2010
Posts: 30

PostPosted: Thu Dec 23, 2010 11:22 pm   

Need assistance with ANSI trigger
 
I've read through past posts for examples. I think I'm doing the right thing, but the pattern is not triggering. I have every option turned on in the debugger. The exact output, including spacing, from the debugger window is

Code:
<ESC>[2m<ESC>[4m<ESC>[2m<ESC>[37m<ESC>[0m<ESC>[0m<LF><CR>
                                    <ESC>[0m<LF><CR>
more stuff...
                                    <ESC>[0m<LF><CR>
                                    <ESC>[0m<ESC>[4m<ESC>[2m<ESC>[4m<ESC>[37m<ESC>[0m<LF><CR><LF><CR>

I am trying to match the line that begins with spaces and ends with <ESC>[0m. This is the trigger I currently have.

Code:
<trigger name="PatStart" priority="2610" ansi="true" enabled="true" id="261">
  <pattern>^%s%e[0m$</pattern>
  <value>
Do stuff...
</value>
</trigger>

This trigger never fires. If I match on just %e[0m, then every line matches. So, it can match the ANSI code. I'm probably not saying it right in the pattern. Suggestions welcome. Thanks.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Fri Dec 24, 2010 1:05 am   
 
Stupid question, but if the line only contains whitespace and is terminated by the reset ansi color code...why bother matching the ansi code?

#trigger {^%s$} ...
_________________
EDIT: I didn't like my old signature
Reply with quote
mose
Novice


Joined: 02 Dec 2010
Posts: 30

PostPosted: Fri Dec 24, 2010 1:20 am   
 
That won't quite do it. I don't want to match all lines that begin with spaces. The reset is a nice marker between sections.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Fri Dec 24, 2010 2:08 am   
 
The problem might be that your mud is sending LFCR instead of the standard CRLF.
Reply with quote
mose
Novice


Joined: 02 Dec 2010
Posts: 30

PostPosted: Fri Dec 24, 2010 1:26 pm   
 
Hmm, interesting observation. Is there a way to tell CMUD what the line terminator is, or can CMUD figure this out by itself?
Reply with quote
mose
Novice


Joined: 02 Dec 2010
Posts: 30

PostPosted: Fri Dec 24, 2010 1:36 pm   
 
I looked through past posts, and a few other muds (incorrectly) send LFCR. Zugg said that CMUD will still work with that in most cases. Someone familiar with the code will need to see if that affects a pattern match that uses begin/end line matches.
Reply with quote
mose
Novice


Joined: 02 Dec 2010
Posts: 30

PostPosted: Sun Jan 02, 2011 3:44 pm   
 
Anyone have a chance to look through the CMUD code to see if LFCR is affecting the pattern match?
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun Jan 02, 2011 3:54 pm   
 
Only Zugg can do that, and he's still on holiday.
_________________
EDIT: I didn't like my old signature
Reply with quote
mose
Novice


Joined: 02 Dec 2010
Posts: 30

PostPosted: Sun Jan 02, 2011 8:44 pm   
 
I have a few more details. It appears that CMUD will sometimes match %e[0m at the end of the line but not at the beginning of the line. It will also match %s%e[0m at the end of the line, but it will not match %e[37m%[0m at the end of the line.
Reply with quote
mose
Novice


Joined: 02 Dec 2010
Posts: 30

PostPosted: Sun Jan 02, 2011 8:46 pm   
 
In case anyone is wondering, this is with CMUDPro 3.33a on Windows XP.
Reply with quote
mose
Novice


Joined: 02 Dec 2010
Posts: 30

PostPosted: Wed Jan 05, 2011 8:21 pm   
 
Any word on matching ANSI codes?
Reply with quote
mose
Novice


Joined: 02 Dec 2010
Posts: 30

PostPosted: Fri Feb 04, 2011 12:57 am   
 
Now that everyone is back from Christmas vacation, is there a solution to this problem?
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Fri Feb 04, 2011 5:57 pm   
 
To determine what ANSI codes to match, make sure the ANSI Color Trigger option is enabled for your trigger. Then go to the main MUD window and select the colored line you want to trigger on. Then go back to the Trigger window and paste into the Pattern field. CMUD will expand any ANSI codes into the proper characters in the trigger pattern.

What you are triggering on here isn't the raw codes that the MUD is actually sending...you are triggering on the ANSI codes that CMUD uses to display the text on the screen.

The LF/CR vs CR/LF issue shouldn't matter since the trigger is firing on the text as it appears on the screen and not what the MUD sends.
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