                         Document on Building in Colour
                     written by Descartes of Borg 3 March 1993

The Nightmare mudlib has a header file and support for allowing players to
see the mud in colour.  There are several different types of ansi simul_efuns
you can use, as well as customizing your own.  We will start with the
simul_efuns:

string ansi_str(string str, string def);

It takes any string and searches it for colour words like purple, blue, red,
green, etc.  It returns a string in which those words alone are colourized.
You need not pass a second argument, but if you do, it should be th colour
in which you want text after the colour word to appear.  The default, if
you pass no second argument, is back to normal colour.
If you have the string str = "The pixie is red and blue.\n";
and you do new_str = ansi_str(str);, it will come out:
"The pixie is REDredNOR and BLUEblueNOR.\n"
(The caps are in to demonstrate where one colour begins and another ends.
NOR is the normal colour)

*NOTE* Room descriptions automatically come through ansi_str for people
       with ansi defined.  You need only add this function to things of your
       own creating.

*****

string ansi_inventory(object ob);

In the Nightmare, certain colours represent certain types of objects, and
for living things, certain colours represent certain states of health.
This function will return a full string listing of the inventory of the
object name using the standard mudlib colour codes for each object.

---------------------------------------------------------------------------

Advanced stuff:

You must do the following for anything described below:
#include <ansi.h>

Maybe you want certain things of your own to be coded specially.  If so,
you should first check to see that the person has ansi defined.  This is
done simply by checking the query_ansi() in the player.  For instance,
if you want the string "This line is red.\n" to appear in red to the player,
you would use the following line:
    if(this_player()->query_ansi()) write(RED+"This line is red.\n"+NOR);
    else write("This line is red.\n");

A complete list of colours and the precompiler definitions which represent
them can be found in /include/ansi.h  As you might guess, RED id red, and
NOR sets it back to normal.
