Welcome to the Builder Academy

Question Trouble getting color to display for class_menu

More
24 Jun 2012 04:07 #228 by Vatiken
Problem solved tonight, it was a case of the colour flags not being turned on.

Just so something gets learned, by default, the Protocol System will function from step 1 of the Greetings screen but colour codes won't be parsed unless colour is set to C_CMP (This can be set to C_NRM or lower in protocol.c around line 1404). If you'd like to set the colour flags right after the greetings screen is recieved, what I've done is this:
nanny() in interpreter.c at CON_GET_NAME:
Code:
if (GET_HOST(d->character)) free(GET_HOST(d->character)); GET_HOST(d->character) = strdup(d->host); d->character->desc = d; CREATE(d->character->player.name, char, strlen(tmp_name) + 1); strcpy(d->character->player.name, CAP(tmp_name)); /* strcpy: OK (size checked above) */ GET_PFILEPOS(d->character) = player_i; + if (d->pProtocol && (d->pProtocol->pVariables[eMSDP_ANSI_COLORS] || + d->pProtocol->pVariables[eMSDP_XTERM_256_COLORS])) { + SET_BIT_AR(PRF_FLAGS(d->character), PRF_COLOR_1); + SET_BIT_AR(PRF_FLAGS(d->character), PRF_COLOR_2); + } write_to_output(d, "Did I get that right, %s (\t(Y\t)/\t(N\t))? ", tmp_name); STATE(d) = CON_NAME_CNFRM; } else { /* undo it just in case they are set */ REMOVE_BIT_AR(PLR_FLAGS(d->character), PLR_WRITING); REMOVE_BIT_AR(PLR_FLAGS(d->character), PLR_MAILING); REMOVE_BIT_AR(PLR_FLAGS(d->character), PLR_CRYO); d->character->player.time.logon = time(0); write_to_output(d, "Password: "); echo_off(d); d->idle_tics = 0; STATE(d) = CON_PASSWORD; } } else { /* player unknown -- make new character */ /* Check for multiple creations of a character. */ if (!valid_name(tmp_name)) { write_to_output(d, "Invalid name, please try another.\r\nName: "); return; } CREATE(d->character->player.name, char, strlen(tmp_name) + 1); strcpy(d->character->player.name, CAP(tmp_name)); /* strcpy: OK (size checked above) */ + if (d->pProtocol && (d->pProtocol->pVariables[eMSDP_ANSI_COLORS] || + d->pProtocol->pVariables[eMSDP_XTERM_256_COLORS])) { + SET_BIT_AR(PRF_FLAGS(d->character), PRF_COLOR_1); + SET_BIT_AR(PRF_FLAGS(d->character), PRF_COLOR_2); + } write_to_output(d, "Did I get that right, %s (\t(Y\t)/\t(N\t))? ", tmp_name); STATE(d) = CON_NAME_CNFRM; } } break;

tbaMUD developer/programmer

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

Time to create page: 0.159 seconds