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
FiendishX
Wanderer


Joined: 19 Nov 2005
Posts: 53

PostPosted: Wed Mar 12, 2008 9:27 pm   

adding ansi patterns conditionally
 
I have a line that generally looks like this...
~~~~~~~~~#####~~~#?~~~~~~~~~~~~
with a bunch of characters with color codes interspersed.

And what I need it to do is take any block of regular symbols following a color code and put the preceding color code in front of each symbol.
so
~~~~~~ would become
~~~~~~
etc. until the next color code.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Thu Mar 13, 2008 12:09 am   
 
My question, really, is why? If they're not being coloured properly, there's something more systemic going on and adding codes of your own probably isn't going to fix it. If there's some other reason, I can't think of it.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
FiendishX
Wanderer


Joined: 19 Nov 2005
Posts: 53

PostPosted: Thu Mar 13, 2008 1:14 am   
 
Why ask why?
The reason why is that I want to be able to replace any of the symbols with a differently colored symbol of my choosing.
So say I have, for example, (green)-----------(white)######(blue)............ and I want to insert a red * somewhere in the middle there, but that will disrupt the coloration since the next symbol doesn't have its own color code. So I need to be able to insert a new color without disrupting other colors. And I need the insert to happen as quickly as possible.

So you see, the problem is not the color display. The problem is what happens when I put something else in the middle.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Thu Mar 13, 2008 1:40 am   
 
I ask why because now you've told me what the real problem is, I can suggest a real solution. There's a much easier way to do that kind of replacement using MXP. Instead of inserting an ANSI code with your * and then trying to resume the previous color, you just insert <color red>*</color> and it'll do it all for you.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
FiendishX
Wanderer


Joined: 19 Nov 2005
Posts: 53

PostPosted: Thu Mar 13, 2008 2:38 am   
 
Hmm...
I never considered using mxp.
Though I'm still curious about non-mxp solutions.
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