[Code] do_set - name changing and log output.

From: Jeremy M. (jkm4802@hotmail.com)
Date: 12/11/02

Hey all,
I'm trying to get a mudlog/syslog message to work, however I'm not
absolutely sure what it entails or what I should do. Here's what I would
"like" to do to the do_set function I'm working on.

1. char old_player_name = GET_NAME(vict);
Basically, I want to store the character's name in the variable
old_player_name so that I can call it for the syslog message the gods see
when a player has his/her name changed. However, I'm not real sure how to do
it..  Currently it merely says something lame like :

[ (GC) George changes Bloomer's name to ... ]

It's supposed to say:

[ (GC) George changes Bloomer's name to Tommas ]

Here's my code in do_set minus the millions of attempts and current ideas
from above, if you can help me out I'd appreciate it. :P

  case 54:
     any_one_arg(val_arg, buf);
    if (buf == NULL || strlen(buf) <= 2) {
      send_to_char("Name is too short.\r\n", ch);
    else if ((i = get_id_by_name(buf)) != -1) {
      send_to_char("A player by that name already exists!", ch);
    else {
      char logbuf[MAX_STRING_LENGTH];
      sprintf(old_name, victim->player.name);
      vict->player.name = 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, "Name changed to %s.", GET_NAME(vict));
      save_char(vict, vict->in_room);
      /* Log and messages - Armageddon */
      sprintf(buf, "Your name has been changed to %s.\r\n", GET_NAME(vict));
      send_to_char(buf, vict);
       sprintf(logbuf, "(GC) %s changes %s's name to ...",GET_NAME(ch),
          mudlog(logbuf, NRM, LVL_LGOD, TRUE);
    send_to_char("Can't set that!\r\n", ch);
    return 0;

STOP MORE SPAM with the new MSN 8 and get 2 months FREE*

   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |

This archive was generated by hypermail 2b30 : 06/25/03 PDT