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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
The Raven
Magician


Joined: 13 Oct 2000
Posts: 463

PostPosted: Tue May 25, 2004 6:29 pm   

Matching ANSI Escape Codes
 
I'm trying to manually parse the colors of various lines. Using an ANSI trigger, I grab the contents of a multi-colored line into a variable, escape sequences and all. What I'm trying to do is iterate through that line, looking for escape sequences and finding out all the colors on that line.

Unfortunately, the escape character is causing problems... I cannot search for it. You can't have the escape code inside a search expression. Has anyone else tried to process ANSI color sequences manually? Do they have any tips?
Reply with quote
The Raven
Magician


Joined: 13 Oct 2000
Posts: 463

PostPosted: Tue May 25, 2004 7:41 pm   
 
I did a workaround... rather than strictly matching the escape sequence, I matched '.[[0-9;]+m'... in other words, I ignore the escape character at the binning, just matching for any character (.), and finding the rest of the normal characters in the sequence (ex '[1;34m'). I'd rather strictly match the escape character, but this should be good enough for now.
Reply with quote
Insomniac
Wanderer


Joined: 25 Mar 2004
Posts: 78
Location: United Kingdom

PostPosted: Tue May 25, 2004 10:13 pm   
 
%e is the token for the escape character (the little square). Also ensure the 'ANSI Trigger' option is enabled on your trigger.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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