This function converts all raw ANSI color codes, carriage returns, and tabs to either MUX substitutions or to spaces. If <type> is 0 or 's', the raw codes are converted to spaces, if it is 1 or 'p', the codes are converted to MUX %c and %r substitutions.
Because multiple spaces can be compressed into a single space, if <type> is 1 or 'p', multiple spaces are converted to a series of '%b' followed by a single space.
The translate() function (as well as its decompose() twin from Penn) can translate evaluated code with ANSI and line breaks to MUSHcode, which is then safe to evaluate again. This can be, but usually is not the same as the original code. It is, however display equivalent to the evaluated code. That is, evaluating the result of translate() will produce the same visual result that the original produced. Side effects and such are lost and results of %N and functions like width() are fixed to the result of the originally evaluated softcode, since there is no way (and it would probably be undesirable) to regain this information from evaluated text.