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
> carnage.mudsrus.com 6669
>
try..
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
krynnmud.ml.org:4000


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