Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ This one has me stumped

This one has me stumped

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Jach   USA  (25 posts)  Bio
Date Sun 12 Oct 2003 06:12 AM (UTC)
Message
While working on creating an area tonight I was surprised to see that my compass was displaying diagonal closed exits incorrectly. This was a simple fix, however any direction NW closed exit displays in the wrong color.

Everything in code looks fine (considering it's all the same as the other exits) and ONLY the NW exits do this. Any ideas?

Jach

"Adults are obsolete children."

Dr. Seuss
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #1 on Sun 12 Oct 2003 05:19 PM (UTC)
Message
Most likely, since its the first direction to be displayed, a color is bleeding into it. The last color must be doing it, so try adding a "&w" or something before the NW exit.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Jach   USA  (25 posts)  Bio
Date Reply #2 on Sun 12 Oct 2003 08:48 PM (UTC)
Message
That's what I thought also, and that is exactly what I did. But it didn't work. See why I'm stumped?

"Adults are obsolete children."

Dr. Seuss
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #3 on Sun 12 Oct 2003 09:02 PM (UTC)
Message
Post the first part of the compass, where it displays NW, or an exit. Have you tried set_char_color( AT_WHITE, ch ); or something like that?

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Jach   USA  (25 posts)  Bio
Date Reply #4 on Sun 12 Oct 2003 09:40 PM (UTC)

Amended on Sun 12 Oct 2003 10:38 PM (UTC) by Jach

Message
Here is where we set the colors all around:


 exitcolor = "&Y";
	if( IS_SET( pexit->exit_info, EX_WINDOW ) )
	   exitcolor = "&C";
	if( IS_SET( pexit->exit_info, EX_SECRET ) )
	   exitcolor = "&b";
	if( IS_SET( pexit->exit_info, EX_CLOSED ) )
	   exitcolor = "&w";
	if( IS_SET( pexit->exit_info, EX_LOCKED ) )
	   exitcolor = "&w";


Here is the NW direction specifically:


if( pexit->vdir == DIR_NORTHWEST )
	if( !IS_SET( pexit->exit_info, EX_CLOSED ) )
		sprintf( dir_nw, "%sNW", exitcolor );
	else if( IS_SET( pexit->exit_info, EX_CLOSED ) )
		sprintf( dir_nw, "%s# ", exitcolor );
	else if( !IS_SET( pexit->exit_info, EX_LOCKED ) )
		sprintf( dir_nw, "%sNW", exitcolor );
	else if( IS_SET( pexit->exit_info, EX_LOCKED ) )
		sprintf( dir_nw, "%s# ", exitcolor );


As I said I tried adding the color code to the closed/locked display but it still didn't work.

"Adults are obsolete children."

Dr. Seuss
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #5 on Sun 12 Oct 2003 10:38 PM (UTC)

Amended on Mon 13 Oct 2003 04:45 AM (UTC) by Zeno

Message
Try changing

sprintf( dir_nw, "%sNW", exitcolor );

to

sprintf( dir_nw, "&wNW" );


By doing this, we can narrow down whats causing the problem.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Jach   USA  (25 posts)  Bio
Date Reply #6 on Sun 12 Oct 2003 10:55 PM (UTC)
Message
Just tried that and it didn't work either. Keep 'em coming though, this is gonna bug me til it's fixed.

"Adults are obsolete children."

Dr. Seuss
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #7 on Wed 15 Oct 2003 01:50 AM (UTC)
Message
Can you post an exit that you know works, just for comparison's sake?

You say the exit is displaying in the wrong color; which color is that exactly and which should it be in?

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Jach   USA  (25 posts)  Bio
Date Reply #8 on Wed 15 Oct 2003 05:15 AM (UTC)
Message
If it will help here it goes:

exitcolor = "&Y";
	if( IS_SET( pexit->exit_info, EX_WINDOW ) )
	   exitcolor = "&C";
	if( IS_SET( pexit->exit_info, EX_SECRET ) )
	   exitcolor = "&b";
	if( IS_SET( pexit->exit_info, EX_CLOSED ) )
	   exitcolor = "&w";
	if( IS_SET( pexit->exit_info, EX_LOCKED ) )
	   exitcolor = "&w";

Default color is "&Y" or Bright Yellow, but when the exit is closed/locked it should be "&w" or default grey. However the NW exit, and only the NW exit, stays Bright Yellow. (Yes the room name is Bright Yellow also, but as covered in the earlier post it's not just a bleed over issue)

Here is the NW exit code again:

if( pexit->vdir == DIR_NORTHWEST )
	if( !IS_SET( pexit->exit_info, EX_CLOSED ) )
		sprintf( dir_nw, "%sNW", exitcolor );
	else if( IS_SET( pexit->exit_info, EX_CLOSED ) )
		sprintf( dir_nw, "%s# ", exitcolor );
	else if( !IS_SET( pexit->exit_info, EX_LOCKED ) )
		sprintf( dir_nw, "%sNW", exitcolor );
	else if( IS_SET( pexit->exit_info, EX_LOCKED ) )
		sprintf( dir_nw, "%s# ", exitcolor );


Here is the SW exit code for comparison:

if( pexit->vdir == DIR_SOUTHWEST )
	if( !IS_SET( pexit->exit_info, EX_CLOSED ) )
		sprintf( dir_sw, "%sSW", exitcolor );
	else if( IS_SET( pexit->exit_info, EX_CLOSED ) )
		sprintf( dir_sw, "%s# ", exitcolor );
	else if( !IS_SET( pexit->exit_info, EX_LOCKED ) )
		sprintf( dir_sw, "%sSW", exitcolor );
	else if( IS_SET( pexit->exit_info, EX_LOCKED ) )
		sprintf( dir_sw, "%s# ", exitcolor );


As you can see the only change to the code is the change of direction name.

"Adults are obsolete children."

Dr. Seuss
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #9 on Wed 15 Oct 2003 06:09 AM (UTC)
Message
Hrm... odd. How about the code that actually prints out the dir_nw, dir_sw and stuff? (instead of printing into the strings, actually sending it to the user.)

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Jach   USA  (25 posts)  Bio
Date Reply #10 on Wed 15 Oct 2003 06:12 AM (UTC)
Message
Here it is:

if( xIS_SET( ch->act, PLR_COMPASS ) )
	{
	   send_to_char( "\n\r", ch );

	   set_char_color( AT_RMNAME, ch );
	   ch_printf( ch, "%-50s", ch->in_room->name );
 
	   strcat( dir_nw, "  " );
	   ch_printf_color( ch, "         %s", dir_nw );
	   strcat( dir_n, "  " );
	   ch_printf_color( ch, "  %s", dir_n );

I tried adding the color code to this also but it still didn't work.

"Adults are obsolete children."

Dr. Seuss
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #11 on Wed 15 Oct 2003 06:34 AM (UTC)
Message
Try sticking a set_char_color (AT_PLAIN, ch) between printing the room name and printing the northwest. Or try printing north before northwest. I don't think we can quite rule out the color bleeding, even if it seems highly unlikely.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Jach   USA  (25 posts)  Bio
Date Reply #12 on Wed 15 Oct 2003 07:34 AM (UTC)
Message
That worked, for the most part. When I did that the NW displayed fine but it screwed up the N display, when I fixed that the NE display was wrong, and so on and so forth. I just carried the set_char_color to each direction and it's working fine now.

Thanks a bunch.

"Adults are obsolete children."

Dr. Seuss
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #13 on Wed 15 Oct 2003 07:46 AM (UTC)
Message
Sounds like it's the funky-evil-color-bleed-of-doom that SMAUG has.

If you look at the routines for set_char_color, and the one that generates ANSI color codes based on the &w etc. tokens, they're not quite the same. One resets the terminal display settings before outputting the color... I think that's set_char_color. The other (make_color_sequence? or something like that) just spits out the display change codes without resetting them... and this can lead to very evil and insiduous color bleeds (such as bold colors going from one line to the next.)

I've found that there are two solutions:
1) fix the two routines
2) use set_char_color(AT_PLAIN) to reset at the beginning of every colored line
...and 2 is usually easier, if messier. :)

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Jach   USA  (25 posts)  Bio
Date Reply #14 on Wed 15 Oct 2003 08:17 AM (UTC)
Message
Hehe, funky-evil-color-bleed-of-doom, is that an official term? Thanks again, I'll make sure I keep an eye out for this happening elsewhere.

"Adults are obsolete children."

Dr. Seuss
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


33,335 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.