[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  Compiling the server
. . -> [Subject]  Need Some help with Ansi\RIP Colors

Need Some help with Ansi\RIP Colors

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


Pages: 1 2  

Posted by Toy   (206 posts)  [Biography] bio
Date Thu 29 Jan 2004 06:36 AM (UTC)

Amended on Sun 01 Feb 2004 03:56 AM (UTC) by Nick Gammon

Message
OK, I've been peeking around in the code and the mud, and I noticed that once a newbie logged in, if you chose either ANSI or RIP, only a blank screen would appear. Baffled, I moved my cursor over the screen, and relized that there was no color on the screen, the words being in black. SO I've tried to edit the ANS file and RIP file in the system folder with a &w before everything, and it's still all black. so I hunted down the part of the code in comm.c under the nanny function. Can someone gimme some help on how to fix this?


	set_pager_color( AT_PLAIN, ch );
	if ( xIS_SET(ch->act, PLR_RIP) )
	  send_rip_screen(ch);
	if ( xIS_SET(ch->act, PLR_ANSI) )
	  send_to_pager( "\033[2J", ch );
	else
	  send_to_pager( "\014", ch );
	if ( IS_IMMORTAL(ch) )
	  do_help( ch, "imotd" );
	if ( ch->level < 50 && ch->level > 0 )
	  do_help( ch, "motd" );
	if ( ch->level == 0 )
	  do_help( ch, "nmotd" );
	send_to_pager( "\n\rPress [ENTER] ", ch );
        d->connected = CON_READ_MOTD;
        break;


Mind you, if you hit no color support, everything works fine.

-Alexander

It's always good to know how far you are willing to go to be the best...

Karl Mancine
aka
Toy the Dark Puppet
[Go to top] top

Posted by Meerclar   USA  (733 posts)  [Biography] bio
Date Reply #1 on Thu 29 Jan 2004 07:50 PM (UTC)
Message
This has actually been covered (and solved) fairly recently. The exact fix escapes me(I don't code SMAUG) but a forum search for "ansi color" should find the related threads. Believe it was a problem with the send_to function not having the proper support for colors and needing to be changed to another function though.

Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Thu 29 Jan 2004 10:29 PM (UTC)
Message
Yes, this one might be it ...

http://www.gammon.com.au/forum/?bbsubject_id=3416

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Toy   (206 posts)  [Biography] bio
Date Reply #3 on Fri 30 Jan 2004 03:00 PM (UTC)
Message
Well, I looked at the post you sent me Nick. I added the lines and changed the calls, but still, all the other colors work fine, there is still two black screens though were the ANS file and the MOTD are supposed to be after you choose ansi support. All the color works after that point, so do you have any other ideas?

-Alexander

It's always good to know how far you are willing to go to be the best...

Karl Mancine
aka
Toy the Dark Puppet
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #4 on Fri 30 Jan 2004 08:53 PM (UTC)
Message
I seem to get a colour screen - in your mudtitle.ans file (is this the one you are looking at?) do you see something like this? ...


^[[2J

              DRAW YOUR ^[[1;36mANSI^[[m TITLE SCREEN IN HERE...................


                                [Press Enter]
~


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Toy   (206 posts)  [Biography] bio
Date Reply #5 on Sat 31 Jan 2004 04:55 PM (UTC)
Message
No. Maybe that's the issue. A long time ago I replaced that message with one I found. mine looks more like this:
========================================================
.

(ansi picture)

blah blah blah

[PRESS ENTER]
========================================================

Is the original stuff from the ANS file necessary to have color in it?

-Alexander

It's always good to know how far you are willing to go to be the best...

Karl Mancine
aka
Toy the Dark Puppet
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #6 on Sat 31 Jan 2004 09:52 PM (UTC)
Message
Well, no.

I tried a mudtitle.ans file with just straight text in it, and it came out fine, white on black, like everything else.

Somewhere you must be sending down a control code to switch to black on black.

What I suggest doing is set "packet debug" in MUSHclient, wait for the title screen to appear, and then look in the packets window to see what code is being sent.

Then, search for the code that sets that code.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Zeno   USA  (2,871 posts)  [Biography] bio
Date Reply #7 on Sat 31 Jan 2004 10:29 PM (UTC)
Message
Are you using SmaugFUSS, or normal Smaug? I have this same problem. New char, lvl 0, mudtitle is totally black. I use SmaugFUSS.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #8 on Sun 01 Feb 2004 03:44 AM (UTC)

Amended on Sun 01 Feb 2004 03:58 AM (UTC) by Nick Gammon

Message
Well, I worked it out, but it wasn't simple. :)

The same thing happened with a fresh compile of SMAUG FUSS, so it isn't anything you did.

It was a straight bug. :)

In nanny in comm.c, in the section CON_GET_WANT_RIPANSI, around line 1986 is this code:


 ch->position = POS_STANDING;
 d->connected = CON_PRESS_ENTER;
 set_pager_color( AT_PLAIN, ch );

... and a little further on ...

 if ( IS_IMMORTAL(ch) )
   do_help( ch, "imotd" );
 if ( ch->level == 50)
   do_help( ch, "amotd" );
 if ( ch->level < 50 && ch->level > 0 )
   do_help( ch, "motd" );
 if ( ch->level == 0 )
   do_help( ch, "nmotd" );
 send_to_pager( "\n\rPress [ENTER] ", ch );



This is supposed to set the colour for the NMOTD help topic to AT_PLAIN (grey), however inside set_pager_color is:


   ch->desc->pagecolor = ch->colors[AType];


If you look at the variable "ch" at this point (in gdb) you see this:


(gdb) p *ch
$1 = {next = 0x0, prev = 0x0, next_in_room = 0x0, prev_in_room = 0x0,
  master = 0x0, leader = 0x0, fighting = 0x0, reply = 0x0, retell = 0x0,
  switched = 0x0, mount = 0x0, hunting = 0x0, fearing = 0x0, hating = 0x0,
  spec_fun = 0, mpact = 0x0, mpactnum = 0, mpscriptpos = 0, pIndexData = 0x0,
  desc = 0x8580ed0, first_affect = 0x0, last_affect = 0x0, pnote = 0x0,
  comments = 0x0, first_carrying = 0x0, last_carrying = 0x0, in_room = 0x0,
  was_in_room = 0x0, pcdata = 0x8583268, last_cmd = 0, prev_cmd = 0,
  dest_buf = 0x0, alloc_ptr = 0x0, spare_ptr = 0x0, tempnum = 0, editor = 0x0,
  first_timer = 0x0, last_timer = 0x0, morph = 0x0, name = 0x8520ac8 "myname",
  short_descr = 0x821ab18 "", long_descr = 0x821ab18 "",
  description = 0x821ab18 "", num_fighting = 0, substate = 0, sex = 1,
  class = 0, race = 0, level = 0, trust = 0, played = 0, logon = 1075606456,
  save_time = 0, timer = 0, wait = 0, hit = 20, max_hit = 20, mana = 100,
  max_mana = 100, move = 100, max_move = 100, practice = 0, numattacks = 0,
  gold = 0, exp = 0, act = {bits = {33556032, 0, 0, 0}}, affected_by = {
    bits = {0, 0, 0, 0}}, no_affected_by = {bits = {0, 0, 0, 0}},
  carry_weight = 0, carry_number = 0, xflags = 0, no_immune = 0,
  no_resistant = 0, no_susceptible = 0, immune = 0, resistant = 0,
  susceptible = 0, attacks = {bits = {0, 0, 0, 0}}, defenses = {bits = {0, 0,
      0, 0}}, speaks = 1, speaking = 1, saving_poison_death = 0,
  saving_wand = 0, saving_para_petri = 0, saving_breath = 0,
  saving_spell_staff = 0, alignment = 0, barenumdie = 1, baresizedie = 4,
  mobthac0 = 0, hitroll = 0, damroll = 0, hitplus = 0, damplus = 0,
  position = 12, defposition = 0, style = 2, height = 72, weight = 180,
  armor = 100, wimpy = 0, deaf = 0, perm_str = 13, perm_int = 13,
  perm_wis = 13, perm_dex = 13, perm_con = 13, perm_cha = 13, perm_lck = 13,
  mod_str = 0, mod_int = 0, mod_wis = 0, mod_dex = 0, mod_con = 0,
  mod_cha = 0, mod_lck = 0, mental_state = -10, emotional_state = 0,
  retran = 0, regoto = 0, mobinvis = 0, colors = {0 <repeats 96 times>}}



Important part in bold. In other words, we are sending AT_PLAIN to the player however the player's colours are not set up yet (all 96 are zero). Thus we send black-on-black as the colour for the help text.

The solution appears to be to set up the default colours when clearing the character data. I did this:


void clear_char( CHAR_DATA *ch )
{

... other stuff here ...

    reset_colors (ch);
    return;
}


That sets default colours along with other character defaults.

Then, the NMOTD screen appears properly.


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #9 on Sun 01 Feb 2004 05:39 AM (UTC)

Amended on Sun 01 Feb 2004 05:40 AM (UTC) by Nick Gammon

Message
Looking a bit harder, I see this in comm.c:


  reset_colors( ch );
  name_stamp_stats( ch );
  ch->level   = 1;
  ch->exp     = 0;
  ch->max_hit    += race_table[ch->race]->hit;
  ch->max_mana   += race_table[ch->race]->mana;


However this is in CON_READ_MOTD (in nanny) *after* the message-of-the-day is sent. Right code, wrong place, IMHO.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Toy   (206 posts)  [Biography] bio
Date Reply #10 on Sun 01 Feb 2004 06:57 AM (UTC)
Message
SWEET! It works now. Thanks alot for your hard working in helping me Nick. Glad to know it wasn't my error. :)

-Alexander the Happy

It's always good to know how far you are willing to go to be the best...

Karl Mancine
aka
Toy the Dark Puppet
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #11 on Sun 01 Feb 2004 07:21 AM (UTC)
Message
Looking further, it seems to me that my earlier fix does not necessarily show the correct colours. When I did it I say the NMOTD but in green, not the full colour.

I have now tried this, in comm.c:


    case CON_GET_WANT_RIPANSI:
        switch ( argument[0] )
        {
        case 'r': case 'R':
            xSET_BIT(ch->act,PLR_RIP);
            xSET_BIT(ch->act,PLR_ANSI);
            break;
        case 'a': case 'A': xSET_BIT(ch->act,PLR_ANSI);  break;
        case 'n': case 'N': break;
        default:
            write_to_buffer( d, "Invalid selection.\n\rRIP, ANSI or NONE? ", 0 );
            return;
        }
      reset_colors( ch );


That seems to work better.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Toy   (206 posts)  [Biography] bio
Date Reply #12 on Sun 01 Feb 2004 05:56 PM (UTC)
Message
OK, I just ran across another color problem. When I altered the ANS file before the word "Fear" I used &R, to make the color show red. Not only did the color not show, but when I logged in a newbie it read "&RFEAR". I know I've run into this color issue before when trying to alter things like do_score. Is there any fix to that?

-Alexander

It's always good to know how far you are willing to go to be the best...

Karl Mancine
aka
Toy the Dark Puppet
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #13 on Sun 01 Feb 2004 08:18 PM (UTC)
Message
First, I think the mudtitle.ans file does not process the &R codes, judging by its contents you need to put the actual code in (eg. ESC[35m or whatever it is).

As for the score command, you probably need to change "send_to_char" to "send_to_char_color" in certain places. The documents in the doc directory explain that bit.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Zeno   USA  (2,871 posts)  [Biography] bio
Date Reply #14 on Sun 01 Feb 2004 08:52 PM (UTC)
Message
Heh, thanks Nick, I never really attempted to try to fix that problem, since it was only for new chars.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
[Go to top] 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.


46,947 views.

This is page 1, subject is 2 pages long: 1 2  [Next page]

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]