Coloured Names code v1.3
Written by Silver <silver@ewtoo.org>


Abstract:

This is the very bare bones code required to have coloured names in your
talker. Its not complete and its not been tested particlary well, so use
it at your own risk and be prepared for a bit of work.


Disclaimer:

Backup, backup and backup. If it screws your pfiles or talker over then
its your own fault. Stick it on a test site first and play! You can't hold
me responsible for anything.


Licence:

This code is released under a very specific licence - you MUST agree to
this licence before you use the code!

 1. Whatever you do, you do it at your own risk
 2. Whatever happens, you don't blame me
 3. You agree there is no support whatsoever
-------------------------------------------------------------------------
 4. If you use this then you MUST:
    a. Never force individuals to view coloured names even if they have
       "muffle cname" on
    b. Never send coloured names over the intercom or ichan in any way
    c. Never disable or remove the "muffle cname" command
-------------------------------------------------------------------------
 5. You give me credit in your "version" command
 6. You accept that there is a lot of work required to get this code fully
    implemented.

Point 4 is for the comfort and enjoyment of others. Not everyone likes
coloured name (I certainly don't) and hence don't want to be forced to
view them. If you don't agree, delete the code now.


Installing:

1. cd to pgplus
2. If you are using PG+ version 1.0.11, do:  
	patch -p0 < path/to/cname_1.0.11.diff
   If you are using PG+ version 1.0.10 or lower, do:  
	patch -p0 < path/to/cname_1.0.10.diff
3. fix any errors
4. copy the cname.c file into your src directory
5. add the text in cname.help into your pgplus/doc/help file
6. check that the loading and saving of sp->cname is the very last thing
   that is done to your pfiles. People who have added new fields should
   know exactly why I mean this. If you don't, think about it!
7. do "make depend" then "make quick"
8. shutdown the talker *fully*
9. boot up again


Whats there:

General communication, looking in rooms and stuff that uses the
construct_list functions should work fine as well as dynatext, examine and
finger. Everything else won't - this is something for you to do.


How to finish the code:

The function you need to know is this:

  get_cname(p, q)

where:    p = the pointer to the player whose name you wish to display
          q = the pointer to the player who you are showing the name to

If you leave q as 0 or NULL then the name will be uncoloured. Sometimes
you may need to have q set to current_player, sometimes you'll want it set
to the same a p (for example when someone is looking at their own name).

For example - this function:

void blah(player *p, char *str)
{
  player *p2;
  p2 = find_player_global_quiet(str);
  if (!p2)
    return;
  TELLPLAYER(p, " Name is %s\n", p2->name);
}

Should have the TELLPLAYER re-written as:

  TELLPLAYER(p, " Name is %s\n", get_cname(p2, p));

here p2 is the name we want and p is the person who will be shown this. By
passing the latter, we can allow people to muffle coloured names. Take a
look at the calls to get_cname in the code for other examples.

***** WARNING *****

Only modify ->name bits if they are displayed to the player. DO NOT change
every single instance or you will corrupt your playerfiles. If you are
unsure, leave it alone and test the command associated.

*******************

Also, be aware that come code copies the players name into a string, like this:

 char n[MAX_NAME];
 strcpy(n, p->name);

when this happens you should change this to:

 char n[MAX_NAME*4];
 strcpy(n, get_cname(p, p));

this is because if someone has a different colour code for each letter of
their name then the string length can be up to 4 times as long.

Thats about it really. If you get stuck, find someone who has implemented
this and ask them :o)

Silver  

ps. And no, I won't be implementing this :o)