|
raviden Novice
Joined: 02 Nov 2010 Posts: 45
|
Posted: Mon Aug 04, 2014 5:14 pm
Keeping MUD color through #SUB |
Hey,
the mud is providing some text with color (ansi/xterm). I'd like to keep that color unchanged while subbing the text. Is there a way to do that? |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Mon Aug 04, 2014 11:19 pm |
Not with the #SUBSTITUTE command, unless you happen to know what the color position is (you can provide the coloring yourself, via %ansi() or the mxp color tag or even the raw ansi code).
If you don't need to replace the entire line, check out #PSUB. |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
raviden Novice
Joined: 02 Nov 2010 Posts: 45
|
Posted: Wed Aug 06, 2014 10:17 pm |
What do you mean by 'color position'?
Coloring myself is not an option, the same line can be coloured by MUD in different colors, depending on data I do not have myself.
I do need to replace whole line, unfortunatly.
Is there not an way to extract color data from mud line, f.e. by using color trigger?
What is mxp color tag? |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Thu Aug 07, 2014 12:09 am |
Quote: |
What do you mean by 'color position'?
|
I mean it in a literal sense. The place where a color code would go if you were building the line yourself.
Quote: |
Coloring myself is not an option, the same line can be coloured by MUD in different colors, depending on data I do not have myself.
Is there not an way to extract color data from mud line, f.e. by using color trigger?
|
CMud has exactly two color-preservation features. The first one does not let you change anything about the line and is better known as the #CAPTURE command. The second is that ansi codes can be matched on and captured into %1...%99 variables when a trigger's Ansi Trigger option is turned on. Outside of these, no color info of any kind is accessible to the user as it's already been processed out of the text stream.
Quote: |
What is mxp color tag?
|
It's just another formatting scheme, in this case it's a part of the MXP spec (which is itself a mudding-specific extension of the XML language). <color blue>this how a blue piece of text is colored via the mxp color tag</color>. |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
raviden Novice
Joined: 02 Nov 2010 Posts: 45
|
Posted: Thu Aug 07, 2014 10:17 pm |
I used the second one for exit #tagging (Colour trigger), however I have no idea how can I capture ansi / xterm code and use that in %ansi, since I dont see where the code is located in the text.
Could you show me an example of the trigger that assigns ansi codes to %1..%99?
This is how an example collored (ansi) line looks like for exit #tag.
<trigger priority="75570" ansi="true" id="7557">
<pattern>%e[1;32m(*).%e[0m$</pattern>
<value>$name = %1.
#tag name {$name}</value>
</trigger> |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Thu Aug 07, 2014 11:44 pm |
You already have the example. If you want to capture data, use () around what you want to capture.
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
raviden Novice
Joined: 02 Nov 2010 Posts: 45
|
Posted: Fri Aug 08, 2014 3:30 pm |
Sorry, I don't know where in that example I can find color data and how to use it properly.
|
|
|
|
raviden Novice
Joined: 02 Nov 2010 Posts: 45
|
Posted: Tue Aug 26, 2014 8:11 pm |
Another problem (last one I didn't solve ofc):
The CMUD colours the line properly, but when i #CAPTURE the line into other window, the colour inherited from previous line, that was painting beginning of my captured line is missing. Any idea how to fix that? |
|
|
|
raviden Novice
Joined: 02 Nov 2010 Posts: 45
|
Posted: Tue Aug 26, 2014 8:26 pm |
It seems it's not from previous line. No idea why not colouring while #capture then:
<27>[0m<27>[22;35mText
<27>[0m<27>[22;38;5;68mText2 <27>[0m<27>[35;1mText3
While in main window Text, Text2 and Text3 are properly coloured, when #capturing second line, only Text3 is coloured. |
|
|
|
raviden Novice
Joined: 02 Nov 2010 Posts: 45
|
Posted: Wed Aug 27, 2014 5:58 pm |
-
|
|
Last edited by raviden on Wed Aug 27, 2014 6:14 pm; edited 1 time in total |
|
|
|
raviden Novice
Joined: 02 Nov 2010 Posts: 45
|
Posted: Wed Aug 27, 2014 6:03 pm |
No, sorry:
<27>[1z<27>[0m<27>[0m<27>[22;38;5;154m(TEXT).<27>[K
vs
<27>[1z(TEXT).<27>[K
It makes sense why there is no color in second line. How to copy whole line then? |
|
|
|
|
|