Game Development Community

Stripping color codes in Torque Script

by Peter Simard · 09/05/2005 (6:55 pm) · 2 comments

Torque has a built in function for stripping out color codes but it is not exposed by default. To expose it add these lines to your console.cc file:

ConsoleFunction(stripColorCodes, const char*, 2,2,  "(stringtoStrip) - remove color chars from the string.")
{
	char* ret = Con::getReturnBuffer( dStrlen( argv[1] ) + 1 );
	dStrcpy(ret, argv[1]);
	stripColorChars(ret);
	return ret;
}

#1
09/15/2005 (12:42 pm)
Ah, this is a good one. #399.
#2
10/26/2005 (1:09 pm)
And it's in. Thank you Peter. I put it in consoleFunction.cc.