Re: [code] [NEWBIE] Question about calling GET_CLASS(ch)

From: Craig Adams (punkrock@IX.NETCOM.COM)
Date: 11/06/98

RHS Linux User wrote:
> In patch level 14 I was tring to add a class display in the function
> do_score in act.informative.c The below is what I tried to use:
>   sprintf(buf, "Class: %d", GET_CLASS(ch));
>   if (GET_REMORT(ch) >= 0) {
>   sprintf(buf,  "   Dual: %d", GET_REMORT(ch));
>  }
> Now I have no compiling problems, but when you type score now it displays
> a number instead of a class name.  I have this same problem when I call
> GET_NAME(ch) in a mudlog command, it just displays a number.  Can anyone
> tell me what is actually be displayed and how I could get it to show the
> proper text?  Thanx.
> -Smillie, IMP
> Maximum Carnage
> 6669
sprintf(buf, "Class: %s ", class_abbrevs[(int) GET_CLASS(ch)]);
and if you've noticed with a player who has remorted, all they see is
"    Dual: <number>" cuz you're rewriting the buf.. make sure to include
the buffer in the call.. i.e.
if (GET_REMORT(ch) >= 0)
 sprintf(buf,  "%s   Dual: %d", buf, GET_REMORT(ch));

-Craig Adams
Administrator of Krynn:Lands of Adventure

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | |

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