//if you have erwin's board system + you're doing this on ROM + you use Lope's colour read on
//if not, discontinue reading
//credit to those who came before me, who gave their life so that i may have none :D
//i don't use erwin's board system myself, but this seems to work for me.
//the regulations regarding this function are that you may not use it to harm any ducks in any way, plus you have to be nice


/*add to merc.h somewhere:
 size_t lopelen(char *string);

in board.c (line 861 stock download) change
 strlen(text)
to
 lopelen(text)

you should also use lopelen instead of strlen anywhere else you think you need it
*/
size_t lopelen(char *string)
{
        const char formatlope [] = { '{', 'x', 'X', 'R', 'G', 'B', 'M', 'Y', 'C', 'W', 'r', 'g', 'b', 'm', 'y', 'c', 'w', '/','D','d', '~'};//that's a lotta colour codes, who needs more
        const char *outputascii [] = { "{", "\033[0m", "\033[0m", "\033[1;31m", "\033[1;32m", "\033[1;34m", "\033[1;35m", "\033[1;33m", "\033[1;36m", "\033[1;37m","\033[0;31m", "\033[0;32m", "\033[0;34m", "\033[0;35m", "\033[0;33m", "\033[0;36m", "\033[0;37m", "\n", "\033[1;30m", "\033[1;30m", "~"};
	int i;
	size_t total=0;
	int lopelen;
	lopelen = sizeof(formatlope) / sizeof(formatlope[0]);

	for(;*string;string++)
	{
		if (*string=='{')
		{
			string++;
			if (*string==0) return total;
			for (i=0; i<lopelen; i++)
			{
				if (*string==formatlope[i])
				{
					total+=strlen(outputascii[i]);
                                        goto here;//yes, use of goto! haha. just to get attention
				}
			}
			total+=strlen(outputascii[1]);//if unknown, use colour CLEAR
                        here: continue;
		}
		total++;
	}
	return total;
}
//that's it, i think you all for coming. i'm in town all week.