[CODE] [LONG] Stat Rolling

From: StormeRider (silk@ICI.NET)
Date: 12/24/97


Wierd bug here. When I moved to the first linux server my mud was on, I
transferred over from Solaris and got everything working except the stat
rolling crashed the mud. So I commented it out and ignored it for a few
months. Then I moved from that server to another linux server and now am
trying to get it to work again. My roll_real_abils is slightly different
than the stock but it's a 4/5 rolls on 5-sided dice and it works no
problem. Here's the stuff from my interpreter.c nanny section:

  case CON_QCLASS:
    load_result = parse_class(*arg);
    if (load_result == CLASS_UNDEFINED) {
      SEND_TO_Q("\r\nThat's not a class.\r\nClass: ", d);
      return;
    } else
      GET_CLASS(d->character) = load_result;
    SEND_TO_Q("\r\nPress enter to roll your stats.", d);
log("QCLASS state almost ended.\r\n");
    STATE(d) = CON_RROLL;
    break;

  case CON_RROLL:
log("Before roll_real_abils");
        roll_real_abils(d->character);
log("After roll_real_abils");
sprintf(buf, "Str: %d", GET_STR(d->character));
log(buf);
sprintf(buf, "Int: %d", GET_INT(d->character));
log(buf);
sprintf(buf, "Wis: %d", GET_WIS(d->character));
log(buf);
sprintf(buf, "Dex: %d", GET_DEX(d->character));
log(buf);
sprintf(buf, "Con: %d", GET_CON(d->character));
log(buf);
sprintf(buf, "Cha: %d", GET_CHA(d->character));
log(buf);
        sprintf(buf, "\r\n"
          " Strength:     [%d]\r\n"
          " Intelligence: [%d]\r\n"
          " Wisdom:       [%d]\r\n"
          " Dexterity:    [%d]\r\n"
          " Constitution: [%d]\r\n"
          " Charisma:     [%d]\r\n",
          GET_STR(d->character),
          GET_INT(d->character), GET_WIS(d->character),
          GET_DEX(d->character), GET_CON(d->character),
          GET_CHA(d->character));
        SEND_TO_Q(buf, d);
        SEND_TO_Q("\r\n\r\nKeep these stats? (y/N)", d);
    STATE(d) = CON_QROLLSTATS;
    break;

  case CON_QROLLSTATS:
log("Entering QROLLSTATS state.\r\n");
    switch (*arg) {
      case 'y':
      case 'Y':
        break;
      case 'n':
      case 'N':
      default:
log("Before roll_real_abils");
        roll_real_abils(d->character);
log("After roll_real_abils");
        sprintf(buf, "\r\n"
          " Strength:     [%d]\r\n"
          " Intelligence: [%d]\r\n"
          " Wisdom:       [%d]\r\n"
          " Dexterity:    [%d]\r\n"
          " Constitution: [%d]\r\n"
          " Charisma:     [%d]\r\n",
          GET_STR(d->character),
          GET_INT(d->character), GET_WIS(d->character),
          GET_DEX(d->character), GET_CON(d->character),
          GET_CHA(d->character));
        SEND_TO_Q(buf, d);
        SEND_TO_Q("\r\n\r\nKeep these stats? (y/N)", d);
        return;
    }
    if (GET_PFILEPOS(d->character) < 0)
      GET_PFILEPOS(d->character) = create_entry(GET_NAME(d->character));
    init_char(d->character);
    save_char(d->character, r_mortal_start_room);
    SEND_TO_Q(motd, d);
    SEND_TO_Q("\r\n\n*** PRESS RETURN: ", d);
    STATE(d) = CON_RMOTD;

    sprintf(buf, "%s [%s] new player.", GET_NAME(d->character), d->host);
    mudlog(buf, NRM, LVL_IMMORT, TRUE);
    break;

It gets past roll_real_abils, logs the stats to a file, and the next thing
in the syslog is: Wed Dec 24 14:02:15 :: Cha: 13
Wed Dec 24 14:02:15 :: Warning: Missed more than 30 seconds worth of pulses
and it eventually shuts down because of nonupdated ticks.

Any clues?


StormeRider                  --- http://www.windsofstorm.net/wos/
silk@ici.net                 --- telnet://cmoo.com:4004


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



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