Newbie: Training stats

From: Craig Wilson (cwilson2@bigpond.net.au)
Date: 12/09/02


Hi guys,

I have been working on adding a train stat command so that my PC's can
train there stats like str, int, etc...

Below the code for the train stat command. The problem I have is that
the command does not change the stat til the person exits the realm. Any
ideas where I could have stuffed up?

CircleMud 3.0 bpl22 with ascii pfiles and olc.
Cheers
Craig.

ACMD(do_train)
{
  char arg[MAX_INPUT_LENGTH];

  if (IS_NPC(ch))
    return;

  one_argument(argument, arg);

  if (!strcmp(arg, "")){send_to_char (ch, " Train <stat> I.e. str int
wis dex con cha"); return;}


  if (GET_CP(ch)<=0)
  {
        send_to_char(ch, "You can only if you havr spare character
points (CP).\r\n");
    return;
  }

  if (!strcmp(arg,"str"))
  {
    if (GET_STR(ch)==18)
    send_to_char(ch, "You can only have 18 Strenght. \r\n");
    else
        {
          int num = GET_STR(ch) +1;
          ch->real_abils.str = num;
      ch->real_abils.cp = GET_CP(ch) -1;
      send_to_char(ch, "Your Strenght is increased by 1 CP. \r\n");
        }
  }else if (!strcmp(arg,"int"))
    {
          if (GET_INT(ch)==18)
          send_to_char(ch, "You can only have 18 Intellect. \r\n");
      else
          {
                int num = GET_STR(ch) +1;
            ch->real_abils.intel = num;
        ch->real_abils.cp = GET_CP(ch) -1;
        send_to_char(ch, "Your Intellect is increased by 1 CP. \r\n");
          }
  }else if (!strcmp(arg,"wis" ))
  {
    if (GET_WIS(ch)==18)
    send_to_char(ch, "You can only have 18 Wisdom. \r\n");
    else
        {
          int num = GET_WIS(ch) +1;
          ch->real_abils.wis = num;
      ch->real_abils.cp = GET_CP(ch) -1;
      send_to_char(ch, "Your Wisdom is increased by 1 CP. \r\n");
        }
  }else if (!strcmp (arg,"con"))
  {
    if (GET_CON(ch)==18)
    send_to_char(ch, "You can only have 18 Constitution. \r\n");
    else
        {
           int num = GET_CON(ch) +1;
           ch->real_abils.con = num;
       ch->real_abils.cp = GET_CP(ch) -1;
       send_to_char(ch, "Your Constitution is increased by 1 CP. \r\n");
         }
  }else if (!strcmp(arg,"dex"))
  {
    if (GET_DEX(ch)==18)
    send_to_char(ch, "You can only have 18 Dexterity. \r\n");
    else
        {
           int num = GET_DEX(ch) +1;
           ch->real_abils.dex = num;
       ch->real_abils.cp = GET_CP(ch) -1;
       send_to_char(ch, "Your Dexterity is increased by 1 CP. \r\n");
         }
  } else if (!strcmp(arg, "cha"))
  {
    if (GET_CHA(ch)==18)
        send_to_char(ch, "You can only have 18 Charisma. \r\n");
    else
        {
           int num = GET_CHA(ch) +1;
           ch->real_abils.cha = num;
       ch->real_abils.cp = GET_CP(ch) -1;
       send_to_char(ch, "Your Charisma is increased by 1 CP. \r\n");
        }
  }
}

--
   +---------------------------------------------------------------+
   | 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