Game Development Community

Stripping color tags ?

by Orion Elenzil · in Torque Game Engine · 01/02/2006 (10:37 am) · 3 replies

I'm occasionally writing the results of say %player.getShapeName() to a log file.
But it has weird characters at the beginning and end: 0x10 0x0c at the front and 0x11 at the end.

I'm pretty sure these are text-coloring tags:
the text is colored when echod in say the Chat Hud,
altho not colored when echod in the console.

Is there an easy wasy to strip these out in script ?

#1
02/10/2006 (7:57 pm)
There is a relatively easy way to do so using the stripChars function, however, you must specify the characters to strip (in this case the color codes), something like so...

%name = stripChars(%name, "\cp\co\c6\c7\c8\c9");

There is also a detag function if you end up getting tagged string index's instead of names... %name = detag(%string);
#2
02/10/2006 (8:04 pm)
There's a function for that:

%name = StripMLControlChars(%name);
#3
02/10/2006 (10:59 pm)
Thanks Martin and Brian.

I didn't expect to ever hear back on this one!