Is there a function somewhere for converting ansi embedded strings to style runs? Or maybe an ansi version of WindowText?
ansi conversion?
Posted by Fiendish on Fri 17 Dec 2010 07:56 AM — 3 posts, 9,551 views.
I don't think so. You could write one easily enough depending on what subset of the spec you wanted to support (eg. do you want to support the 256-colour variants?).
It seems odd though that you can't get the MUD to send you the more natural colour codes. A while back for the inventory plugin I thought it was silly for the MUD to read in codes like @G for green, convert them to ANSI (itself some work) and then have the client convert them back before displaying. Thus I got Lasher to simply send me the MUD codes (like @W, @G etc.).
But if that isn't possible, some sort of string.gmatch that pulls out sequences like ESC ... m and then decodes the stuff inside that into individual numbers separated by commas or whatever it is, and then looking them up in a table, should do it.
The general technique is in methods_noting.cpp in the C++ source, function AnsiNote.
However since you are interested in speed, I would try to bypass the whole need for it.
It seems odd though that you can't get the MUD to send you the more natural colour codes. A while back for the inventory plugin I thought it was silly for the MUD to read in codes like @G for green, convert them to ANSI (itself some work) and then have the client convert them back before displaying. Thus I got Lasher to simply send me the MUD codes (like @W, @G etc.).
But if that isn't possible, some sort of string.gmatch that pulls out sequences like ESC ... m and then decodes the stuff inside that into individual numbers separated by commas or whatever it is, and then looking them up in a table, should do it.
The general technique is in methods_noting.cpp in the C++ source, function AnsiNote.
However since you are interested in speed, I would try to bypass the whole need for it.
Yeah, I guess it's better to just get the MUD to send native color codes instead of ansi sequences.