Re: NEWBIE CODE: I need some help with color prompts...

From: Johan Dustler (epkjodu@hmepks1.ericsson.se)
Date: 06/24/96


> From: Stryfe <likens19@MO.NET>
> 
> Hello everyone.  This being my first message, I hope that it gets through 
> to everyone ok.  Here is my problem (actually it is two-fold): a.)I would 
> like to add conditional color to my prompt (ie. green, yellow and red) 
> but I haven't been able to get it to compile and b.)Today is the first 
> day I have ever seen a piece of C code in my life, so I am still a bit 
> shaky when it comes to the language structure.  Here is what I have so far:
> 
>     if (PRF_FLAGGED(d->character, PRF_DISPHP))
>       if (GET_HIT(d->character) >= ((GET_MAX_HIT(d->character) / 3) * 2))
>         sprintf(prompt, "%s%s%d%sH", prompt,
> 	CCGRN(??????, C_CMP), CCNRM(??????, C_CMP),
> 	GET_HIT(d->character)); 
>       else if ((GET_HIT(d->character) < ((GET_MAX_HIT(d->character) / 3) *
>         2)) && (GET_HIT(d->character) >= ((GET_MAX_HIT(d->character) /
> 	3))))
>           sprintf(prompt, "%s%s%d%sH", prompt, 
> 	  CCYEL(??????, C_CMP), CCNRM(??????, C_CMP),
>           GET_HIT(d->character)); 
>     }
>       
> 
> Now, my question is this:  What the heck am I supposed to put in place of 
> the ??????s ?  And is it necessary to also have the C_NRM and C_SPR 
> conditions in place as well?  Please help me out because I am totally out 
> of ideas.  Thanks for your time.
> 
> -Sentinel
> likens19@mail.mo.net
> 

C_SPR, C_NRM and C_CMP are the different color grades a player can
choose to see with the color command. If you want all players to be
able to see the color prompt independent of color grade you should
put in C_SPR instead.

The ?????? should be a pointer to the struct of the player that are
going to see the prompt in this case d->character.

You also have to change the order of the variables in the sprintf
statements so that GET_HIT() comes before CCNRM(). This is the reason
why you haven't been able to compile it. The compiler expects an integer
and you give it a pointer to a string, then it expects a pointer to a
string and you give it an integer.

-Johan



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