Re: write_to_descriptor question

From: Daniel Koepke (dkoepke@california.com)
Date: 01/18/97


On Sat, 18 Jan 1997, Brian Williams - Nashak wrote:

> how would I make it so write_to_descriptor could handle colors... I am
> trying to make my own cool little promtp so it shows the
> tank tankcond enemy and enemycond.. don't tell me to use the new_prompt
> patch.. cuz' that is totally irrelevant to this post.. the question is
> about write_to_descriptor :P anyways.. I tried changing the
> write_to_descriptor which sends the prompt to SEND_TO_Q(prompt, d).. but
> obviously that didn't work too well, since it sends it like 5 times every
> second in that case.. thanks in advance for any help though.. also instead
> of write_to_descriptor.. are there any other functions that send to the
> descriptor? possibly any that can handle colors?

SEND_TO_Q() queues the data for sending via write_to_descriptor().  If
you make write_to_descriptor() use SEND_TO_Q(), you've thus created a
loop that will go until the data is removed from the queue (which
apparently will happen after the fifth time around).  As with my
interpret_colors(), it returns the string with the color codes either
stripped or changed into the ANSI color codes (depending upon whether
'parse' is FALSE or TRUE, respectively).  If you have a color parser
that returns the parsed string, you can simply call it not from
within the write_to_descriptor() function, but in that instance:

  write_to_descriptor(d->descriptor, interpret_colors(prompt,
                      PRF_FLAGGED(d->character, PRF_COLOR_2)));

Something like that...


--
Daniel Koepke
dkoepke@california.com
Forgive me father, for I am sin.


+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



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