On Sat, 19 Jan 2002 03:43:43 -0600, Patrick Dughi <dughi@imaxx.net> wrote:
>> Ok, I'm using circle mud bp17 with Oasis OLC. I also have implemented
the
>> easy color code where you just use the &R, &4 &f, etc. code to put color
in
>> there.
>> This is currently what my prompt looks like
>>
>> &R****/****H&n &W****/****M&n &C****/****V&n >
>>
>> where the **** are however many points you have for
>> hitpoints/maxhit/mana/maxmana, etc.
>>
>> It works fine, except when I hit enter, with no commands it gives me the
>> source code so to speak of the prompt like this:
>>
>> &R5000/5000H&n &W5000/5000M&n &C5000/5000V&n >
>>
>> I was wondering if there was a way to fix this
>> When I hit enter with no commands, I would like it to just be a normal
>> prompt. Could this be a cause of my color code? or a wrong piece of
source
>> code somewhere?
>
> Hm. If it's only when you don't type a command, that's curious -
>check and insure that your 'make_prompt()' function is always running the
>color embedding function of your choice. Calls to make_prompt() only
>happen in comm.c, and they only happen twice (in the version I'm looking
>at). Your specific error should be quick and easy to track down.
>
> Just remember, by default (even with color codes installed) the
>prompt is usually never passed through the color parser. You're lucky
>because apparently it only doesn't do that when you hit return by
>itself... that means you find the 'good' case, and just copy the code :)
>
> PjD
>
>--
> +---------------------------------------------------------------+
> | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
> | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
> | Newbie List: http://groups.yahoo.com/group/circle-newbies/ |
> +---------------------------------------------------------------+
Ok, I think I've found the problem but I'm still not quite sure on how to
fix it. I think this is the code I'm having the trouble with I will
highlight the part that makes it not work.
int process_output(struct descriptor_data *t)
{
char i[MAX_SOCK_BUF];
int result;
/* we may need this \r\n for later -- see below */
strcpy(i, "\r\n");
/* now, append the 'real' output */
strcpy(i + 2, t->output);
/* if we're in the overflow state, notify the user */
if (t->bufptr < 0)
strcat(i, "**OVERFLOW**\r\n");
/* add the extra CRLF if the person isn't in compact mode */
if (STATE(t) == CON_PLAYING && t->character && !IS_NPC(t->character) && !
PRF_FLAGGED(t->character, PRF_COMPACT))
strcat(i + 2, "\r\n");
/* add a prompt */
strncat(i + 2, make_prompt(t), MAX_PROMPT_LENGTH);
if(t->character) *** Trouble is with these
proc_color(i + 2, (clr(t->character, C_NRM))); *** two lines
/*
* now, send the output. If this is an 'interruption', use the prepended
* CRLF, otherwise send the straight output sans CRLF.
*/
if (t->has_prompt) /* && !t->connected) */
result = write_to_descriptor(t->descriptor, i);
else
result = write_to_descriptor(t->descriptor, i + 2);
/* handle snooping: prepend "% " and send to snooper */
if (t->snoop_by) {
SEND_TO_Q("% ", t->snoop_by);
SEND_TO_Q(t->output, t->snoop_by);
SEND_TO_Q("%%", t->snoop_by);
}
<---SNIP-->
if(t->character)
proc_color(i, (clr(t->character, C_NRM)));
These two lines are the ones giving me trouble I think anyways.
If I move those lines, then the color doesn't work at all, it will just
give me the source code. If I comment any part of it out it crashes my
mud, and if I comment the whole thing out it doesn't work either.
Any suggestions?
--
+---------------------------------------------------------------+
| FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
| Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
| Newbie List: http://groups.yahoo.com/group/circle-newbies/ |
+---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 06/25/03 PDT