Re: NEWBIE: Adding color to world files.

From: Mark Devlin (markd@eskimo.com)
Date: 05/19/96


On Sun, 19 May 1996, Fionn Colvin wrote:

>        I recently got mark's function which parses color codes in text. 
> He suggested that it could be used with all send_to_char function calls. 
> What I'd like to know is what files I'll have to change all my calls to 
> send_to_char, to call the color function first, if I add color codes to 
> my object, mob and world files? Is it just act.inform, and act.item? Or do 
> I have to edit others?

You can put the call right in the send_to_XXX() functions.  You may need
to allocate a temporary buffer to pass to parse_color_tokens() and then
pass the temp buffer to SEND_TO_Q:

void send_to_char(char *messg, struct char_data *ch)
{
	char buf[MAX_STRING_LENGTH];

	if (ch->desc && messg)
	{
		parse_color_tokens(ch, messg, buf, sizeof(buf));
		SEND_TO_Q(buf, ch->desc);
	}
}

Also, something I forgot to mention is that if you use anyone else's world
files (including the stock world), you'll need to make sure any _single_
TOKCHAR's (ie. '%') are doubled (ie. '%%').  Otherwise, they won't show up
in the output, or if they have a color string after them, they'll change
the color.

- Mark
markd@eskimo.com	(finger markd@eskimo.com for my PGP signature)
http://www.eskimo.com/~markd	U.S.A. Home of the Alternate Reality page



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