I noticed something today. I know smaug has rough issues with color, and do_title is no exception.
void do_title( CHAR_DATA *ch, char *argument )
{
if ( IS_NPC(ch) )
return;
set_char_color( AT_SCORE, ch );
if ( ch->level < 30 )
{
send_to_char( "Sorry... you must be at least level 30 to set your title...\n\r", ch );
return;
}
if ( IS_SET( ch->pcdata->flags, PCFLAG_NOTITLE ))
{
set_char_color( AT_IMMORT, ch );
send_to_char( "The Gods prohibit you from changing your title.\n\r", ch );
return;
}
if ( argument[0] == '\0' )
{
send_to_char( "Change your title to what?\n\r", ch );
return;
}
if ( strlen(argument) > 50 )
argument[50] = '\0';
smash_tilde( argument );
set_title( ch, argument );
send_to_char( "Ok.\n\r", ch );
}
When in the mud i tried this:
title &rTest
And it came out like this:
Head Admin Lord ToyTest.
The word 'Test' in red like it should be, but it removes the space between the name and the title. I can't seem to figure out how to fix that. Anyone know how or what i'm not seeing?
That's a feature, actually. It's removing the space so that you can have titles like "Fred, the Adventurer". I believe that the rule it follows is that if the first character is not a letter, it removes the space.
OK, well, it sorta works. When you make a title in the game, everything works fine. Save, and quit. Come back in and the space between your name and title are gone. Thinking it's a issue with fread_char not supporting color in your title. I'll post again if I find out if that's right or not.
-Toy
-edit-
OK, I think I found where the problem is, just not sure how to rectify it.
in save.c under fread_char
If I'm not mistaken the read functions skip over all whitespace in the beginning.
I still think it would be much easier if you just did what Whiteknight suggested. :) That will work and chances are that you're going to break something here if you mess with it too much. :P
Didn't realise that the smaug and the SWR method was different, but here might be another option for titles: Have it display the title but not their name, and leave it up to them to put their name in the title. It allows a little more flexabilty, as they can have "Greven the Geek" or "President Greven of Geeks". Just a thought. The code is in player.c in the swrfuss packages available through Nicks download area should anyone be interested.
there's a place for the title, put a space in between the name %s and the title %s, that worked for me. i don't have my code with me right now so i can't show you, but it's there. it's like this:
Ah, yes, but then you can't use comma-titles anymore, so no good. e.g. no more: Ksilyan, the coder who likes commas. :)
The "right" way to do this is to figure out if the title starts with punctuation in which case you remove the space, and if it starts with a letter or the color you add the space, but if it starts with color and punctuation you remove the space, etc.
Or, you take the easy way out and just add spaces in titles manually. :)
Yes yes, you can do that. but I took out titles for my players. i don't see the sense in having them for players. just an accident waiting to happen. plus they need to RP their characters so that others will know what their "title" should be. but that's my logic. so only my IMM's have titles. and the titles go like this:
[Supreme Entity ] Ithildin - The newbie coder
all i did was "title '- The newbie coder'"
but that's just me. and that's the easy way around it ;)
On our MUD the players have to petition the staff for titles, and we check that they have a good bio that matches their title. That way, the "accident waiting to happen" problem is solved. :)
Easy ways around things aren't good when they take away features that used to be there. :-)
If you add a space in the display, then you have to go edit every single place where you print the title - and everybody who subsequently uses your codebase has to be aware of this "quirk".
On the other hand, if the title itself contains the space, then life is good and the birds are singing - you no longer have to change anything whatsoever.
Basically to change the display is a mistake in program design, simply in that the space should be proper to the title and not the display. By fixing the display, you are fixing the symptom but not the disease, and this is rather self-obviously not the right way to go about doing things. :)