Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ Title and Colors

Title and Colors

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


Pages: 1 2  

Posted by Toy   (206 posts)  Bio
Date Sat 05 Jun 2004 05:56 PM (UTC)

Amended on Sat 05 Jun 2004 05:57 PM (UTC) by Toy

Message
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?

-Toy

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

Karl Mancine
aka
Toy the Dark Puppet
Top

Posted by Nick Cash   USA  (626 posts)  Bio
Date Reply #1 on Sat 05 Jun 2004 10:14 PM (UTC)
Message
Uh, you could do title &r Test I think :)

~Nick Cash
http://www.nick-cash.com
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #2 on Sat 05 Jun 2004 10:45 PM (UTC)
Message
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.

Whiteknight's solution should work fine.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #3 on Sun 06 Jun 2004 05:27 AM (UTC)
Message
One of the MUDs I admin on has that fixed. But I assume it justs adds an extra space, in the code. I could look it up.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Toy   (206 posts)  Bio
Date Reply #4 on Sun 06 Jun 2004 06:48 AM (UTC)
Message
Please, if you could. Not horribly important, I just like having all the little details fixed. :)

-Toy

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

Karl Mancine
aka
Toy the Dark Puppet
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #5 on Sun 06 Jun 2004 07:05 AM (UTC)
Message
No difference in do_title except strlen(argument) > 47

Maybe set_title.

void set_title( CHAR_DATA *ch, char *title )
{
    char buf[MAX_STRING_LENGTH];

    if ( IS_NPC(ch) )
    {
        bug( "Set_title: NPC.", 0 );
        return;
    }

    if ( isalpha(title[0]) || isdigit(title[0]) )
    {
        buf[0] = ' ';
        strcpy( buf+1, title );
    }
    else if ( title[0] == '&' )
    {
        buf[0] = ' ';
        strcpy( buf+1, title );
    }
    else
        strcpy( buf, title );

    STRFREE( ch->pcdata->title );
    ch->pcdata->title = STRALLOC( buf );
    return;
}


Any difference?

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Toy   (206 posts)  Bio
Date Reply #6 on Sun 06 Jun 2004 05:55 PM (UTC)
Message
Yup, that works. Thanks. :)

-Toy

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

Karl Mancine
aka
Toy the Dark Puppet
Top

Posted by Toy   (206 posts)  Bio
Date Reply #7 on Sun 06 Jun 2004 06:59 PM (UTC)

Amended on Sun 06 Jun 2004 09:57 PM (UTC) by Toy

Message
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 ( !strcmp( word, "Title" ) )
	    			{
					ch->pcdata->title = fread_string( fp );
		
					if ( isalpha(ch->pcdata->title[0])
					||   isdigit(ch->pcdata->title[0]) )
					{
		    				sprintf( buf, " %s", ch->pcdata->title );
		    
		    				if ( ch->pcdata->title )
		      					STRFREE( ch->pcdata->title );
		    					ch->pcdata->title = STRALLOC( buf );
					}

					fMatch = TRUE;
					break;
	    			}
				break; 


Pretty sure the problem lies in the code.

-Toy

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

Karl Mancine
aka
Toy the Dark Puppet
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #8 on Mon 07 Jun 2004 01:00 AM (UTC)
Message
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

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Greven   Canada  (835 posts)  Bio
Date Reply #9 on Mon 07 Jun 2004 06:48 PM (UTC)
Message
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.

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
Top

Posted by Ithildin   USA  (262 posts)  Bio
Date Reply #10 on Mon 07 Jun 2004 08:36 PM (UTC)
Message
look for do_who function.

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:

%s %s%s%s%s%s

name, title, clan, blah blah blah...

Ithildin *space* the newbie coder

Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #11 on Mon 07 Jun 2004 10:14 PM (UTC)
Message
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. :)

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Ithildin   USA  (262 posts)  Bio
Date Reply #12 on Mon 07 Jun 2004 11:46 PM (UTC)
Message
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 ;)


hence the name right now newbie coder heh
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #13 on Tue 08 Jun 2004 01:37 AM (UTC)
Message
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. :-)

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Toy   (206 posts)  Bio
Date Reply #14 on Tue 08 Jun 2004 05:57 PM (UTC)
Message
Ok, so I've got the titles saving properly, and it shows great on the do_who screen.

Head Admin Lord Toy the Dark Puppet

So, after checking some more things out, I realized that there was another problem with spacing.

(Immortal) Lord Toythe Dark Puppet is here before you.

I've tracked the issue down to show_char_to_char section of act_info.c. Still working on fixing it, but not having much luck atm.

-Toy

PS. Spacing + Smaug colors = Pain in the ass. :)


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

Karl Mancine
aka
Toy the Dark Puppet
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.


60,116 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 page

Go to topic:           Search the forum


[Go to top] top

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