Color in the Create Character Menu

  • jandulio
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 months 1 week ago #9996 by jandulio
Color in the Create Character Menu was created by jandulio
I see when I first connect to the server the color red is shown at the top of the screen when it's figuring out my capabilities:

     <red here>          <red here>      <red here> ....
[Client] CMUD | [Colors] Ansi | [MXP] Yes | [MSDP] No | [ATCP] No

The problem is, I'm having trouble getting color to show up in the main menus of the mud where you choose your character class.  I've tried "@g" color combinations and "\tG" with no luck.

I even tried copy/pasting the values from the capabilities and that doesn't work either.  Hoping someone has some ideas, thanks.

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

More
6 months 1 week ago #9997 by thomas
Replied by thomas on topic Color in the Create Character Menu
Quite strange.

The correct code in should be \t<code> (ie \tg).

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

  • jandulio
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 months 1 week ago #9998 by jandulio
Replied by jandulio on topic Color in the Create Character Menu
I tried \tg, \tn, all of them.

I actually don't see the \tg when it prints, but there is no color either. It's like it knows it's a color code, but just doesn't do it. Colors look while in-game no problem, I use them all over the place. It's just this one area that I can't get to work. The Male/Female, Class, etc. screens are where I have the issue.

Agreed, it's very odd. I'm going to try to debug it sometime today or tomorrow, but the parsing stuff is difficult to look at so crossing my fingers it's not too crazy.

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

More
6 months 1 week ago #10001 by thomas
Replied by thomas on topic Color in the Create Character Menu
Ok, got around to testing this, finally.

The "\t" character is an actual tab character. This is quite easy to insert directly when editing the file (though it won't look nice in your editor with a bunch of whitespace thrown in). In this example, the word "name" is in blue:
$ cat ../lib/text/greetings
...
By what 	Bname	n do you wish to be known? 

output:
By what name do you wish to be known? 

In "internal" strings in the code, like the password prompt, a tab char is difficult to work with, so you can use \t there:
           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: ");
+          write_to_output(d, "Pa\tOss\tGword:\tn ");
           echo_off(d);
           d->idle_tics = 0;
           STATE(d) = CON_PASSWORD;
Outputs Password with ss in "orange" and "word" in green.

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

  • jandulio
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 months 1 week ago #10003 by jandulio
Replied by jandulio on topic Color in the Create Character Menu
Thanks for the reply @Thomas

Color works on the password line for me when logging in an already-created character, but not when I am creating a new character...

Can you try this:

default:
write_to_output(d, "That is not a sex..\r\n"
"What IS your sex? ");
return;
}

- write_to_output(d, "%s\r\n\tOClass: ", class_menu);
+ write_to_output(d, "%s\r\n Class: ", class_menu);

This is the character selection screen (the one I am having issues with).

This doesn't work for me, but it's possible that I have something else messing this up with my highly modified code.

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

More
6 months 6 days ago #10012 by thomas
Replied by thomas on topic Color in the Create Character Menu
Ah, well I debugged a bit. There is a check for "color level" in the protocol.c file (on line 2518) where it checks the preferences of the player.
New players have "no prefs" - defaulting to no color to show (their character struct is empty).

If we want them to have color by default, which we probably would if they support it, we must set the relevant preferences in interpreter.c:
diff --git a/src/interpreter.c b/src/interpreter.c
index 0dadad0..92eabc4 100644
--- a/src/interpreter.c
+++ b/src/interpreter.c
@@ -1409,7 +1409,13 @@ void nanny(struct descriptor_data *d, char *arg)
           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;
-          write_to_output(d, "Did I get that right, %s (\t(Y\t)/\t(N\t))? ", tmp_name);
+
+          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 */
@@ -1433,6 +1439,11 @@ void nanny(struct descriptor_data *d, char *arg)
         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;
       }
The following user(s) said Thank You: jandulio

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

  • jandulio
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 months 6 days ago #10013 by jandulio
Replied by jandulio on topic Color in the Create Character Menu
Awesome, I'll give this a shot. I'd really like to get the class menu colorized.

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

  • jandulio
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 months 5 days ago #10014 by jandulio
Replied by jandulio on topic Color in the Create Character Menu
That did the trick, thanks again @thomas!

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

  • jandulio
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 months 5 days ago #10015 by jandulio
Replied by jandulio on topic Color in the Create Character Menu
I spoke too soon. Now color doesn't work on the "Welcome" screen where you enter the choice to enter game, change password, etc.

I'm moving on from color in the front menus, but at least I have color on the class select screen.

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

More
6 months 4 days ago - 6 months 4 days ago #10016 by thomas
Replied by thomas on topic Color in the Create Character Menu
Well, for that particular menu (and a couple of others) you can edit them in cedit (configuration editor).
Image showing cedit in use

When you then add the colors as @codes, you convert them to colors with /t and get this output:
image showing resultant menu

 
Last edit: 6 months 4 days ago by thomas. Reason: images. We should look into whether images should be working better...

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

  • jandulio
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 months 4 days ago #10018 by jandulio
Replied by jandulio on topic Color in the Create Character Menu
OMG, did not know that existed! That screen scrolls up so quickly I thought it was just the bottom options.

You are the best, thanks again!

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

Time to create page: 0.213 seconds