Re: [Circle] DO_SCORE

From: BlackWind (BlackWind@multiplex.com)
Date: 11/16/96


Gerald Wichmann wrote:
> 
> I don't generally like posting code and asking people to fix my
> problems for me but.. well.. i guess i'm breaking my own rules :). I
> was writing my own SCORE display and below is what i got down..
> Unfortunetly it crashes when i type SCORE in the game and nothing is
> displayed at all (so not much help there). Anyways i'd appreciate a
> quick lookover if anyone sees anything obvious that i'm just too brain
> dead to see right now..
> 
> Also i've been making a lot of changes and would like to reset the mud
> (erase whatever test characters and all i've generated so far. Whats
> the proper way to completely reset the mud? I'm sure this info is
> somewhere as well but i don't recall where..
> 
> ------------------------------------------------
> 
> ACMD(do_score)
> {
> int i;
> struct time_info_data playing_time;
> struct time_info_data real_time_passed(time_t t2, time_t t1);
> 
> sprintf(buf,
> "---------------------------------------------------------------------------\r\n");
> 
> sprintf(buf, "NAME : %-32.30s AGE : %d\r\n",GET_NAME(ch),GET_AGE(ch));
> 
> sprintf(buf, "RACE : %-32.30s ALIGN :
> %d\r\n",GET_RACE(ch),GET_ALIGNMENT(ch));
> sprintf(buf, "CLASS : %-32.30s LEVEL :
> %d\r\n",GET_CLASS(ch),GET_LEVEL(ch));
> sprintf(buf, "HEIGHT : %-32.30d WEIGHT :
> %d\r\n",GET_HEIGHT(ch),GET_WEIGHT(ch));
> sprintf(buf, "TITLE : %s\r\n",GET_TITLE(ch));
> sprintf(buf,
> "---------------------------------------------------------------------------\r\n");
> 
> if (GET_CLASS(ch) == CLASS_WARRIOR && GET_STR(ch) == 18)
> sprintf(buf, "STR : %-32.30d/%d Hit Points :
> %d/%d\r\n",GET_STR(ch),GET_ADD(ch),GET_HIT(ch),GET_MAX_HIT(ch));
> else
> sprintf(buf, "STR : %-32.30d Hit Points :
> %d/%d\r\n",GET_STR(ch),GET_HIT(ch),GET_MAX_HIT(ch));
> sprintf(buf, "INT : %-32.30d Mana :
> %d/%d\r\n",GET_INT(ch),GET_MANA(ch),GET_MAX_MANA(ch));
> sprintf(buf, "WIS : %-32.30d Armor Class :
> %d\r\n",GET_WIS(ch),GET_AC(ch));
> sprintf(buf, "DEX : %-32.30d Move Points :
> %d/%d\r\n",GET_DEX(ch),GET_MOVE(ch),GET_MAX_MOVE(ch));
> sprintf(buf, "CON : %-32.30d Experience :
> %d/%d\r\n",GET_CON(ch),GET_EXP(ch),(titles[(int)
> GET_CLASS(ch)][GET_LEVEL(ch) + 1].exp) - GET_EXP(ch));
> sprintf(buf, "CHA : %-32.30d Gold :
> %d/%d\r\n",GET_CHA(ch),GET_GOLD(ch),GET_BANK_GOLD(ch));
> sprintf(buf,
> "---------------------------------------------------------------------------\r\n");
> 
> sprintf(buf, "HIT ROLL : %-32.30d DAMAGE ROLL :
> %d\r\n",(ch)->points.hitroll,(ch)->points.damroll);
> sprintf(buf, "SAVING THROWS: PAR[%d] ROD[%d] PET[%d] BRE[%d]
> SPE[%d]\r\n",GET_SAVE(ch,0),GET_SAVE(ch,1),GET_SAVE(ch,2),GET_SAVE(ch,3),GET_SAVE(ch,4));
> 
> sprintf(buf,
> "---------------------------------------------------------------------------\r\n");
> 
> 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);
  ^^^
See here where you call the buf again after calling it before the text?
After looking through this, you forgot to add this to most of the
sprintf's.  This is most likely what's makeing it crash...here's an
example of what one of the ones should look like; 


sprintf(buf, "INT : %-32.30d Mana :
%d/%d\r\n",GET_INT(ch),GET_MANA(ch),GET_MAX_MANA(ch));

Change this to:

sprintf(buf, "INT : %-32.30d Mana :
%d/%d\r\n", buf, GET_INT(ch),GET_MANA(ch),GET_MAX_MANA(ch));
            ^^^
        See the second buf?

	Hope I helped,
		Blackwind
+-----------------------------------------------------------+
| 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/18/00 PST