Re: Training Snippet

From: Deja Augustine (PraetorXI@aol.com)
Date: 04/22/00


In a message dated 4/22/00 5:08:22 AM Central Daylight Time,
whatley@lewiston.com writes:

> Thanks for responding.
>
>  Here's the same thing with the beginning of the spec_proc:
>
>  -[snip]-
>  SPECIAL(trainer)
>  {
>      if (IS_NPC(ch) || !CMD_IS("train"))
>          return 0;
>
>    one_argument(argument, arg);
>
>    if (!*arg)
>    {
>      sprintf(buf,"Hit:%d Mana:%d Str:%d Con:%d Wis:%d Int:%d Dex:%d
>  Cha:%d\r\n",
>        GET_MAX_HIT(ch), GET_MAX_MANA(ch), GET_STR(ch), GET_CON(ch),
>  GET_WIS(ch),
>        GET_INT(ch), GET_DEX(ch), GET_CHA(ch));
>      sprintf(buf,"%sYou have %d training session",buf, GET_TRAINS(ch));
>      if (GET_TRAINS(ch) == 1)
>         sprintf(buf,"%s.\r\n",buf);
>      else
>         sprintf(buf,"%ss.\r\n",buf);
>      send_to_char(buf,ch);
>      return 1;
>    }
>
>    if (GET_TRAINS(ch) <= 0) {
>      send_to_char("You do not seem to be able to train now.\r\n", ch);
>      return 1;
>    }
>
>    if (strcmp(arg, "hit")==0)
>      {
>        GET_TRAINS(ch) -=1;
>        GET_MAX_HIT(ch) +=5;
>      } else
>  -[snip]-
>      {
>        send_to_char("Train what?\r\n",ch);
>        return 1;
>      }
>    send_to_char("You train for a while...\r\n",ch);
>    return 1;
>   }
>
>  And if you have trains all it does is go directly to the invalid arg
> statement,
>  if you have no trains it give you the GET_TRAINS <= 0  message.
>


Just a thought, but why don't you have it print out the argument, if one is
invalid, for debug purposes, so you can make sure that there IS in fact
something in arg.  Just change the last bit like this:

  {
    send_to_char("Train what?\r\n",ch);
    sprintf(buf, "Arg = %s\r\n", *arg);           <----- Insert this line
    return 1;
  }

That should do the trick (I think you use *arg, but I've always had a problem
remembering when to use the * operator, so you might need to take it out if
it doesn't work).

Good Luck

-Praetor


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



This archive was generated by hypermail 2b30 : 04/10/01 PDT