Re: [NEWBIE]

From: Carlo Mocci (mocci@TIN.IT)
Date: 05/09/98


You are overwriting buf each time you use sprintf (buf, .....).

Try using sprintf (buf, ....) the first time you use it in a function.
Then always use strcat, or sprintf (buf+strlen(buf)).

Afetr that, send_to_char (buf, ch);
Hope this helps.

Carlo Mocci
Kabir
dalila.shopitaly.net 4000

At 12.27 09/05/98 -0500, you wrote:
>Okay, Im stumped. I noticed the age wasnt being displayed in score. I
>looked at the code, played with it, but dont understand why it doesnt
>show. I believe it has to do with the second section of code that shows
>stats if youre above level 10, but Im not sure why. Any pointers for me?
>Here is the snippett from my do_score:
>
>ACMD(do_score)
>{
>  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));    <--------------
>this doesnt print
>
>  if ((age(ch).month == 0) && (age(ch).day == 0))
>    strcat(buf, "  It's your birthday today.\r\n");
>  else
>    strcat(buf, "\r\n");
>
>/*added by firefox (displays stats)*/          <----------------
>slightly modified code below
>
>if (GET_LEVEL(ch)>=10)
>   sprintf(buf, "Str: [%d/%d]  Int: [%d]  Wis: [%d]  "
>   "Dex: [%d]  Con: [%d]  Cha: [%d]\r\n",
>   GET_STR(ch), GET_ADD(ch),
>   GET_INT(ch),
>   GET_WIS(ch),
>   GET_DEX(ch),
>   GET_CON(ch),
>   GET_CHA(ch));
>
>
>/*end added by firefox */
>
>
>
>sprintf(buf,
>       "%sYou have %d(%d) hit, %d(%d) mana and %d(%d) movement
>points.\r\n",
>   buf, GET_HIT(ch), GET_MAX_HIT(ch), GET_MANA(ch), GET_MAX_MANA(ch),
>   GET_MOVE(ch), GET_MAX_MOVE(ch));
>
>  sprintf(buf, "%sYour armor class is %d/10, your alignment is %d, and
>your magic resistance is %d.\r\n",
>   buf, GET_AC(ch), GET_ALIGNMENT(ch), GET_MAGIC_RES(ch));
>
>------end snippett--------
>
>If I move the GET_AGE code below the modified show attributes code, the
>attributes dont print.
>If I move the GET_AGE code down into the middle of the function,
>anything above it doesnt print.
>
>Thanks for any help.
>
>Travis
>
>
>     +------------------------------------------------------------+
>     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
>     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
>     +------------------------------------------------------------+
>
>
---------------------------------------------------------------
|        __         __            __  __         __       __  |
|   __  (  )  ___  (  )    __    (  \/  )  __   / _)  __ (  ) |
|  / _) /__\ (  ,)  )(__  /  \    )    (  /  \ ( (_  / _) )(  |
| ( (_ (_)(_) )  \ (____)( () )  (_/\/\_)( () ) \__)( (_ (__) |
|  \__)      (_)\_)       \__/            \__/       \__)     |
|                                                             |
| mailto: mocci@tin.it                                        |
| http://volftp.tin.it/IT/IT/ITALIANI/MOCCI                   |
| http://www.geocities.com/SunsetStrip/Palms/7010             |
---------------------------------------------------------------


     +------------------------------------------------------------+
     | 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/15/00 PST