buf bug??

From: Max (max@astrodata.ee)
Date: 07/31/96


helo.

ehm, so. i writed a small command HP.
SO? ANY COMMENTS? code looks fine... how i could clear the buf?

its the DO_SCORE code:
ACMD(do_hp)
{
   sprintf(buf, "%sYou have %d(%d) hit and %d(%d) movement
   points.\r\n", buf, GET_HIT(ch), GET_MAX_HIT(ch), GET_MOVE(ch),
   GET_MAX_MOVE(ch)); send_to_char(buf, ch);
}

when i type hp in mud it says:
You have 500(500) hit and 82(82) movement points.
and typing it again it adds +1  same command:
You have 500(500) hit and 82(82) movement points.
You have 500(500) hit and 82(82) movement points.
etcetc

and typing score;hp it adds score contents before getting to hp's 
function. score works normally.
score source is almost original, only mana showing is taken out.
here is da coDe:
ACMD(do_info)
{
  struct time_info_data playing_time;
  struct time_info_data real_time_passed(time_t t2, time_t t1);

  sprintf(buf, "You are %d years old.", GET_AGE(ch));

  if ((age(ch).month == 0) && (age(ch).day == 0))
    strcat(buf, "  It's your birthday today.\r\n");
  else
    strcat(buf, "\r\n");

  sprintf(buf,
       "%sYou have %d(%d) hit and %d(%d) movement points.\r\n",
          buf, GET_HIT(ch), GET_MAX_HIT(ch), GET_MOVE(ch),
          GET_MAX_MOVE(ch));


  sprintf(buf, "%sYou have scored %d exp, and have %d gold
  coins.\r\n",
          buf, GET_EXP(ch), GET_GOLD(ch));

  if (!IS_NPC(ch)) {
    if (GET_LEVEL(ch) < LVL_IMMORT)
      sprintf(buf, "%sYou need %d exp to reach your next level.\r\n",
      buf,
        (titles[(int) GET_CLASS(ch)][GET_LEVEL(ch) + 1].exp) -
        GET_EXP(ch));

    playing_time = real_time_passed((time(0) - ch->player.time.logon)
    +
                                  ch->player.time.played, 0);
    sprintf(buf, "%sYou have been playing for %d days and %d
    hours.\r\n",
          buf, playing_time.day, playing_time.hours);

    sprintf(buf, "%sThis ranks you as %s %s (level %d).\r\n", buf,
          GET_NAME(ch), GET_TITLE(ch), GET_LEVEL(ch));
  }

  switch (GET_POS(ch)) {
  case POS_DEAD:
    strcat(buf, "You are DEAD!\r\n");
    break;
  case POS_MORTALLYW:
<<<<<<<----- SNIP ------->>>>>> <-- blah, positions showing..
  case POS_STANDING:
    strcat(buf, "You are standing.\r\n");
    break;
  default:
    strcat(buf, "You are floating.\r\n");
    break;
  }

  if (GET_COND(ch, DRUNK) > 10)
    strcat(buf, "You are intoxicated.\r\n");

  if (GET_COND(ch, FULL) == 0)
    strcat(buf, "You are hungry.\r\n");

  if (GET_COND(ch, THIRST) == 0)
    strcat(buf, "You are thirsty.\r\n");
<<<<<---- SNIP ---->>>>> <-- conditions, IS_AFFECTED showing...
  if (PRF_FLAGGED(ch, PRF_SUMMONABLE))
    strcat(buf, "You are summonable by other players.\r\n");

  send_to_char(buf, ch);
}


                                                                                                               Max.

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



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