Re: changing a chars name

From: Michael Buselli (
Date: 02/22/96

On Thu, 22 Feb 1996, Romulus.. Imp of Phoenix Mud wrote:

> I am trying to generate a function to change a players name
> while the person is online for unacceptable names according
> to our name policy. I got the function to change the name
> online but when the player logs in he has to use the old name to log 
> into the mud, but comes into the mud as the new name. 
> I looked in save_char in db.c, but I was kinda dumbfounded 
> on how to go about making the name save in the pfile.. and make
> char_file_u char->name  the same as

     You are not understanding the problem here.  The name is fine in the 
player file, but the mud keeps another array of the player's names that 
is used for mailing and logging in, which is why they have to use the old 
name to log in.  I have implemented a change of name field in the do_set 
command, which I will share below.

     There was a bug (I don't know if it's been fixed yet) in circle that
still existed up to at least patch level 7 where new characters weren't
being properly added to the player_table array under odd and unlikely
circumstances, but I noticed the bug because when it did happen it broke
my renamer.  I spend days looking for the error only to find that my
renamer's code was fine when I found the real bug.

     I did send a report to Jeremy, but at first he confused it with
another bug that he had previously fixed and when I appealed to him again
(with instructions on how to break the mail system because of the bug) I
never got a responce (I assume he was just busy).  Anyway, if you're using
pl7 or earlier, you'll need to fix the bug for certain, and possibly if
you're using a later version as well.  I'll need to look up the details
about it because I fixed it so long ago that I forgot the relevant

     I implemented the renamer in a set field, and here is the code from
the big switch in do_set().  It is straight from my mud, so I haven't
modified it to look like it would be implemented in standard circle. 
However I think that since my mud is a patch level 5 backbone you should
be able to figure it all out.  If you have questions, feel free to ask.

  case 61:
    any_one_arg(val_arg, buf);
    if (buf == NULL || strlen(buf) <= 2) {
      send_to_char("Perhaps a longer name would be nice?\r\n", ch);
    else if ((i = get_id_by_name(buf)) != -1) {
      send_to_char("A player by that name already exists!", ch);
    else {
      sprintf(buf1, "%s has been rechristened %s!", vict->, buf);
      infolog(buf1, NULL);
      vict-> = str_dup(buf);
      for (i = 0; i <= top_of_p_table; i++)
        if ((player_table + i)->id == GET_IDNUM(vict))
      if ((player_table + i)->name)   /* Another redundant check? */
        free((player_table + i)->name);
      CREATE((player_table + i)->name, char, strlen(buf) + 1);
      for (j = 0;
           (*((player_table + i)->name + j) = LOWER(buf[j])); j++);
      sprintf(buf, "Done.  That player will now be known as %s.",
      check_autowiz(vict, GET_LEVEL(vict));

Michael Buselli

This archive was generated by hypermail 2b30 : 12/07/00 PST