Re: [NEWBIE][CODE] [LONG] Saving Player Stats

From: flawed (flawed@io.com)
Date: 03/14/01


On Wed, 14 Mar 2001, Jeremy Overbay wrote:
> ----- Original Message -----

[snip]

> > Try one of these:

> > act.wizard.c:1327:      vict->real_abils.intel = 25;

> these are all part of wiz commands and seem to have nothing to do with
> initial character generation.

[snip]

> > constants.c:543:  {7, 14, 1750, 40},    /* str = 25 */

> this is part of the ability score applies code...also seems to be nothing to
> do with initial character generation.

[snip]

> > db.c:2540:  ch->real_abils.intel = 25;

> these define the stats of a god character(usually the first to log into the
> mud).

[snip]

> yeah...simple...but still not helpful. Unless somehow the stat editor is
> defaulting to god abilities...but the level is staying at 1 and they don't
> have any other godly attributes...just the ability scores. weird stuff. I
> guess I will mess around with it a bit more....but I may just put stat
> editor after class like in the snippet even though this will not allow me to
> limit classes according to ability scores. ::shrug:: Not the best
> situation...but I know it will work.
>
> thank you much,
>
> l8r

I started out with asking the list a problem with the stats saving and I
managed to fix it myself. It was a problem in interpreter.c for certain.
I dont recall the exact line, but this is what I have for it. Note that I
have the player pick a class last, rather than roll their stats, so some
shifting of lines had to be taken to get it to work correctly. Sorry this
is rather long, but I wanted to make sure some people with the similar
problem I had might be able to benefit with seeing everything.

Also note: With how I did it Ive noticed no problems with the plr_index.



**Mailer code**

    SEND_TO_Q(race_menu, d);
    SEND_TO_Q("\r\nRace: ", d);
    STATE(d) = CON_QRACE;
    break;

  case CON_QRACE:
    if ((GET_RACE(d->character) = parse_race(*arg)) == RACE_UNDEFINED) {
      SEND_TO_Q("\r\nThat's not a race.\r\nRace: ", d);
      return;
    }

   SEND_TO_Q(ethos_menu, d);
   SEND_TO_Q("Ethos: ", d);
   STATE(d) = CON_QETHOS;
   break;

  case CON_QETHOS:
    load_result = parse_ethos(*arg);
    if (load_result == ETHOS_UNDEFINED){
      SEND_TO_Q("\r\nThat's not an ethos.\r\nEthos: ", d);
      return;

   } else if (is_valid_ethos(GET_CLASS(d->character), load_result) !=
TRUE){
      SEND_TO_Q("\r\nThat is not a valid ethos for your class.\r\n
Ethos: ", d);
      return;
    } else
      GET_ETHOS(d->character) = load_result;

      switch (GET_ETHOS(d->character))
        {
                case 'a': case 'A':
                        GET_ALIGNMENT(d->character) = 1000;
                case 'b': case 'B':
                        GET_ALIGNMENT(d->character) = 0;
                case 'c': case 'C':
                        GET_ALIGNMENT(d->character) = -1000;
        }

    SEND_TO_Q(deity_menu, d);
    SEND_TO_Q("Deity: ", d);
    STATE(d) = CON_QDEITY;
    break;

  case CON_QDEITY:
    load_result = parse_deity(*arg);
    if (load_result == DEITY_UNDEFINED){
      SEND_TO_Q("\r\nThat's not a deity.\r\nDeity: ", d);
      return;
   } else if (is_valid_deity(GET_ETHOS(d->character), load_result) !=
TRUE){
      SEND_TO_Q("\r\nThat is not a valid deity for your ethos.\r\n
Deity: ", d);
      return;
   } else
     GET_DEITY(d->character) = load_result;

    if (GET_PFILEPOS(d->character) < 0)
      GET_PFILEPOS(d->character) = create_entry(GET_NAME(d->character));


    init_char(d->character);

    if (!d->olc)
      CREATE(d->olc, struct oasis_olc_data, 1);

    STATE(d) = CON_QSTATS;
    init_stats(d);
    break;

  case CON_QSTATS:
    if (parse_stats(d, arg)) {

      if(d->olc) free(d->olc);
      save_player_index();
      save_char(d->character, NOWHERE);


    SEND_TO_Q(class_menu, d);
    SEND_TO_Q("\r\nClass: ", d);
    STATE(d) = CON_QCLASS;
    break;

  case CON_QCLASS:
    if ((GET_CLASS(d->character) = parse_class(*arg)) ==
CLASS_UNDEFINED) {
      SEND_TO_Q("\r\nThat's not a class.\r\nClass: ", d);
      return;
    }

      SEND_TO_Q(motd, d);

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/04/01 PST