Welcome to the Builder Academy

Question Trouble getting color to display for class_menu

More
24 Jun 2012 02:17 #222 by Liko

Vatiken wrote: The issue with this is if someone attempts to connect using a client without ANSI support. What occurs on their screen may range from nothing, to a blurb of weird characters, to a client crash/disconnect.

I'd be interested to see your "case CON_QCLASS:" in interpreter.c, and your "class_menu[]" in class.c, to see if I can't figure out what's happening.

Code:
const char *class_menu = "\r\n" "\x1B[1;30m(\x1B[1;31m*\x1B[1;30m)\x1B[1;37m----------------\x1B[1;30m(\x1B[1;31m*\x1B[1;30m)\x1B[0;0m\r\n" " \x1B[47m| Class Selection \x1B[47m|\x1B[0;0m\r\n" "\x1B[1;30m(\x1B[1;31m*\x1B[1;30m)\x1B[1;37m----------------\x1B[1;30m(\x1B[1;31m*\x1B[1;30m)\x1B[0;0m\r\n" " \x1B[47m| A) Knight \x1B[47m|\x1B[0;0m\r\n" " \x1B[47m| B) Mage \x1B[47m|\x1B[0;0m\r\n" " \x1B[47m| C) Priest \x1B[47m|\x1B[0;0m\r\n" " \x1B[47m| D) Thief \x1B[47m|\x1B[0;0m\r\n" "\x1B[1;30m(\x1B[1;31m*\x1B[1;30m)\x1B[1;37m----------------\x1B[1;30m(\x1B[1;31m*\x1B[1;30m)\x1B[0;0m\r\n" " \x1B[47m| Z) toggle between\x1B[47m|\x1B[0;0m\r\n" " \x1B[47m| class selection \x1B[47m|\x1B[0;0m\r\n" " \x1B[47m| and help menu. \x1B[47m|\x1B[0;0m\r\n" "\x1B[1;30m(\x1B[1;31m*\x1B[1;30m)\x1B[1;37m----------------\x1B[1;30m(\x1B[1;31m*\x1B[1;30m)\x1B[0;0m\r\n";
Code:
case CON_QCLASS: if(!strcmp(arg, "z") || !strcmp(arg, "Z")) { write_to_output(d, "%s\r\nClass Help: ", class_menu); STATE(d) = CON_QCLASS_HELP; return; } load_result = parse_class(*arg); if (load_result == CLASS_UNDEFINED) { write_to_output(d, "\r\nThat's not a class.\r\nClass: "); return; } else GET_CLASS(d->character) = load_result; if (d->olc) { free(d->olc); d->olc = NULL; } if (GET_PFILEPOS(d->character) < 0) GET_PFILEPOS(d->character) = create_entry(GET_PC_NAME(d->character)); /* Now GET_NAME() will work properly. */ init_char(d->character); save_char(d->character); save_player_index(); write_to_output(d, "%s\r\n*** PRESS RETURN: ", motd); STATE(d) = CON_RMOTD; /* make sure the last log is updated correctly. */ GET_PREF(d->character)= rand_number(1, 128000); GET_HOST(d->character)= strdup(d->host); mudlog(NRM, LVL_GOD, TRUE, "%s [%s] new player.", GET_NAME(d->character), d->host); /* Add to the list of 'recent' players (since last reboot) */ if (AddRecentPlayer(GET_NAME(d->character), d->host, TRUE, FALSE) == FALSE) { mudlog(BRF, MAX(LVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE, "Failure to AddRecentPlayer (returned FALSE)."); } break;

You can ignore the color code for now :P thats just a temp fix, but I did post what you asked for.

Randian(0.0.0)
Owner/Developer

Please Log in or Create an account to join the conversation.

More
24 Jun 2012 02:28 #223 by Vatiken
CON_QCLASS seems good, although I was hoping to see class_menu[] with the protocol codes.
Questions:
1) CON_QSEX has MXP codes, does it display the colour codes?
2) if it does, will class_menu[] display MXP codes?

tbaMUD developer/programmer

Please Log in or Create an account to join the conversation.

More
24 Jun 2012 02:37 #224 by Liko

Vatiken wrote: CON_QCLASS seems good, although I was hoping to see class_menu[] with the protocol codes.
Questions:
1) CON_QSEX has MXP codes, does it display the colour codes?
2) if it does, will class_menu[] display MXP codes?


1) No, it does not.

2) I did have them, it didn't show, that is when I went to the way you seen above is the only way I have got any kind of colour to show.

Randian(0.0.0)
Owner/Developer

Please Log in or Create an account to join the conversation.

More
24 Jun 2012 02:51 #225 by Vatiken
So CON_QSEX will display the MXP codes, but the next state (CON_QCLASS) does not? And then your MOTD does? Your source code is inhabited by an evil spirit, it's the only explanation.

tbaMUD developer/programmer

Please Log in or Create an account to join the conversation.

More
24 Jun 2012 02:53 #226 by Liko

Vatiken wrote: So CON_QSEX will display the MXP codes, but the next state (CON_QCLASS) does not? And then your MOTD does? Your source code is inhabited by an evil spirit, it's the only explanation.


QSEX doesn't display the colour, but MOTD, Greeting, Wizlist does.

Randian(0.0.0)
Owner/Developer

Please Log in or Create an account to join the conversation.

More
24 Jun 2012 03:05 #227 by Vatiken
MXP code != Colour code.
I'm on your MUD, so I know CON_QSEX is sending the protocol codes through protocol_output() to display MXP on my screen, and assuming your MOTD isn't littered with ANSI escape codes like you changed class_menu[] to, then it's being handled by protocol_output() as well. So that means protocol_output() is displaying atleast MXP by CON_QSEX, and is displaying colour by CON_MOTD. So somewhere in between, something is either being sent incorrectly, or something is crippling protocol_output().

tbaMUD developer/programmer

Please Log in or Create an account to join the conversation.

Time to create page: 0.269 seconds