OBJECT
DAEMONPATH colour_d
SYNOPSIS
#include <daemons.h>
COLOUR_D->lfun();
DESCRIPTION
The colour-daemon returns translation mappings for use with the
terminal_colour-efun. The translation mappings for the terminal-
types should not be used outside the message-handler of std/player
(std/player/message.c).
string ClassToToken( int class);
Retuns the full class token %^cmsg_xxx%^ for a given class
like CMSG_GENERIC
string ClassToString(int class);
Returns the class string, e.g. 'generic' for a class
int StringToClass(string s);
Returns the number of the class for a given string
string * QueryColourNames();
Returns an array of foreground colour names to use with %^-macros,
indexed by the ansi-number scheme, i.e. black 0 etc.
mapping QueryTTYTrans( string tty );
Returns the translation table for the given terminal-type. If the
terminal-type is unknown, the table for the dumb-terminal is
returned.
mapping QueryNullTrans();
Returns the translation table to strip all colour-macros from a
string if used with terminal_colour.
mapping QueryIdentTrans();
Returns the translation table to indentically translate the colour-
macros found inside a string if used with terminal_colour. This is
useful to wrap strings with terminal_colour without expanding the
colour-macros itself.
mapping QueryClassTrans( mapping ClassColors, string tty );
Returns the colour-translation mapping for the given ClassColors
(from std/player/message) and the given tty. Note that the plain
color translations from QueryTTYTrans() are not included.
EXAMPLES
string str;
str = "%^GREEN%^This is green%^RESET%^";
str = terminal_colour( str, COLOUR_D->QueryNullTrans() );
will result in str == "This is green", all macros removed.
----------------------------------------------------------------
string str;
str = "%^GREEN%^This is %^BLUE%^ a long string%^RESET%^";
str = terminal_colour( str, COLOUR_D->QueryIdentTrans(), 80 );
will result in str properly wrapped at 80 chars (without couting
the length of the colour macros inside).
FILES
DAEMONPATH colour_d.c
/save/daemons/colour.o
INHERITANCE TREE
DAEMONPATH colour_d
`-/obj/lib/daemon_data
AUTHOR
Mica@OSB
SEE ALSO
terminal_colour(E)