Re: Auto diag...

From: Leonardo Herrera L. (leherrer@ENTELCHILE.NET)
Date: 08/03/97


Adam Beytin wrote:
>
> > I think I am just overlooking something silly here.
> >
> > When the mob I am fighitng is dead, it tries to diag them and crashes out
> > the MUD. I thought the GET_POS would clear that up, but it is still
> > crashing. Can anyone offer advice? Thanks.

I have another solution...  I never get an error with this.
(you need to add another toggle bit, PRF_AUTOSTAT)
--------------------------------------------------------------------------------

/* this is diag_char_to_char with a minor modify... */
char * stat_fight(struct char_data * i, char * puf)
{
  int percent;

  if (!i)
    return( "" );
  if (GET_MAX_HIT(i) > 0)
    percent = (100 * GET_HIT(i)) / GET_MAX_HIT(i);
  else
    percent = -1;               /* How could MAX_HIT be < 1?? */

  if (percent >= 100)
    strcpy(puf, "excellent condition");
  else if (percent >= 90)
    strcpy(puf, "few scratches");
  else if (percent >= 75)
    strcpy(puf, "small wounds and bruises");
  else if (percent >= 50)
    strcpy(puf, "few wounds");
  else if (percent >= 30)
    strcpy(puf, "big nasty wounds");
  else if (percent >= 15)
    strcpy(puf, "pretty hurt");
  else if (percent >= 0)
    strcpy(puf, "awful condition");
  else
    strcpy(puf, "almost dead");
  return(puf);
}

void make_prompt(struct descriptor_data *d)
{
  char prompt[MAX_INPUT_LENGTH];

  if (d->str)
    write_to_descriptor(d->descriptor, "] ");
  else if (d->showstr_count) {
    sprintf(prompt,
            "\r[ Return to continue, (q)uit, (r)efresh, (b)ack, or page number
(%d/%d) ]",
            d->showstr_page, d->showstr_count);
    write_to_descriptor(d->descriptor, prompt);
  } else if (!d->connected) {
    char prompt[MAX_INPUT_LENGTH];

    *prompt = '\0';

    if ( FIGHTING(d->character) ) {
      if (!IS_NPC(d->character) && PRF_FLAGGED(d->character,
PRF_AUTOSTAT)) {
        sprintf( prompt, "[You:%s][%s:%s]\r\n", stat_fight(d->character,
buf1),
          GET_NAME(FIGHTING(d->character)),
stat_fight(FIGHTING(d->character), buf2 ));
      }
    }
    strcat(prompt, "<");

    if (GET_INVIS_LEV(d->character))
      sprintf(prompt, "%si%d ", prompt, GET_INVIS_LEV(d->character));

    if (PRF_FLAGGED(d->character, PRF_DISPHP))
      sprintf(prompt, "%s%dhp ", prompt, GET_HIT(d->character));

    if (PRF_FLAGGED(d->character, PRF_DISPMANA))
      sprintf(prompt, "%s%dma ", prompt, GET_MANA(d->character));

    if (PRF_FLAGGED(d->character, PRF_DISPMOVE))
      sprintf(prompt, "%s%dmv", prompt, GET_MOVE(d->character));

    strcat(prompt, "> ");
    write_to_descriptor(d->descriptor, prompt);
  }
}


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