Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
auth_update crash
Dec 23, 2017, 10:15 pm
By Remcon
check_tumble
Dec 18, 2017, 7:21 pm
By Remcon
parse description bug
Dec 15, 2017, 10:08 pm
By Remcon
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Users Online
CommonCrawl, Sogou

Members: 0
Guests: 15
Stats
Files
Topics
Posts
Members
Newest Member
478
3,708
19,242
612
Jacki72H
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » AFKMud Support & Development » do_who (ismaug.c)
Forum Rules | Mark all | Recent Posts

do_who (ismaug.c)
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Sep 29, 2003, 11:23 pm   Last edited Nov 24, 2007, 3:47 pm by Samson
Go to the top of the page
Go to the bottom of the page

Tonne

GroupMembers
Posts7
JoinedSep 25, 2003

Ok heres whats I've done
changed all refrences->interfaces to INT_SMAUG
then i only have to deal with ismaug.c right?

So, 2 things.
1) instead of just display just the class, I want to display level/class. BUT, instead of displaying level, i'm using a switch to give a string to each sets of levels.
ie:
instead of
[ 56 Mage ] Tonne
I'm doing
[ Masterful Mage ] Tonne

I'm doing it in sets of 10
So, right after this line in ismaug.c:
if( MXP_ON(ch) && wch->pcdata->homepage && wch->pcdata->homepage[0] != '\0' )
           sprintf( char_name, MXP_TAG_SECURE"%s"MXP_TAG_LOCKED, wch->pcdata->homepage, wch->name );
        else
           strcpy( char_name, wch->name );

        sprintf( class, "%3d %s", wch->level, class_table[wch->class]->who_name );


I put:
if ( wch->level == 0 )
             titlev = "This is wrong";
    else if ( wch->level level pcdata->realm] );
        else
           sprintf( class, "&z[&GA &g%s-10s &G%s-10s&z]&w", titlev, class_table[wch->class]->who_name );


I know further done is the main sprintf call (class, char_name, extra_title etc etc) but should these changes i've made to the above take effect even if I leave the main sprintf call alone?

It all compiles fine, but when i type who in game it still says
Mage Tonne the blah blah

I am also doing up matching imm titles with the same switch instead of calling up the realm names i'll just go by level
ie:
if (wch->level == 115)
wiztit = "Implementor";
if (wch->level == 114)
wiztitle = "Assist Imp";
etc etc etc

Will this work?

Sorry for the silly questions and long post,its just been so frigging long :P

-Tonne
       
Post is unread #2 Sep 30, 2003, 4:28 am   Last edited Nov 24, 2007, 3:47 pm by Samson
Go to the top of the page
Go to the bottom of the page

Xorith
The Null Value
GroupAFKMud Team
Posts254
JoinedFeb 23, 2003

Oh boy... um... ;)

First - when working with strings, there's only really two ways to work with them.

char *titlev;
titlev = str_dup( "This is a title" );


Or

char titlev[MAX_STRING_LENGTH];
sprintf( titlev, "%s", "This is a title" );


It's morning. I might be a little wrong ;)

Actually, in thinking... I do believe:
char titlev[MSL];
strcpy( titlev, "This is a title" );


Will also work. Mind fuzzy! Damn it!

So given what you said... I don't see a way to use a switch case without too much work... so:

if ( wch->level == 0 )
            strcpy( titlev, "This is wrong" );
   else if ( wch->level level level == 0 )
    strcpy( titlev, "A Newbie" );
else if ( wch->level level <= 20 )
   strcpy( titlev, "A Beginner" );
else 
   strcpy( titlev, "An Unknown" );


Oh, and nice name.. wiztit ;)
Rather than use another variable, you could just add more cases to it... however look around. More specifically look at how the WizList works. You might find an easier way.

-- X
       
Post is unread #3 Sep 30, 2003, 4:33 am   Last edited Nov 24, 2007, 3:47 pm by Samson
Go to the top of the page
Go to the bottom of the page

Xorith
The Null Value
GroupAFKMud Team
Posts254
JoinedFeb 23, 2003

Ah sheeeet ;)

I see one little tiny bug here.

if ( wch->level == 0 )
            strcpy( titlev, "This is wrong" );
   else if ( wch->level level level == 0 )
            strcpy( titlev, "This is wrong" );
   else if ( wch->level level > 0 )
            strcpy( titlev, "Untrained" );
   else if ( wch->level level > 10 )
            strcpy( titlev, "Beginner" );
   else 
      strcpy( titlev, "Huh?" );


Now good luck coming up with titles for all 100 levels or it seems for you, you'd need 10.

-- X
       
Post is unread #4 Sep 30, 2003, 7:43 am
Go to the top of the page
Go to the bottom of the page

Tonne

GroupMembers
Posts7
JoinedSep 25, 2003

Ok understand that, and should of used strcopy but I was falling asleep..but regardless
even if the variable titlev isn't getting a value, should the changes I've made to the who output not be seen?
For instance, the brackets, the colour codes around the realm name? And if note, should I make these changes further down in the main sprintf call? Or what about sprintf(buf instead of sprintf(class)

Some ideas.

Xorith r u on MSN by any chance?

-Tonne/Darren

thanks again X
       
Post is unread #5 Sep 30, 2003, 1:55 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

Using the pcdata->clan )
{
if( victim->level pcdata->clan->pkills[0]++;
else if( victim->level pcdata->clan->pkills[1]++;
else if( victim->level pcdata->clan->pkills[2]++;
else if( victim->level pcdata->clan->pkills[3]++;
else if( victim->level pcdata->clan->pkills[4]++;
else if( victim->level pcdata->clan->pkills[5]++;
else if( victim->level pcdata->clan->pkills[6]++;
else if( victim->level pcdata->clan->pkills[7]++;
else if( victim->level pcdata->clan->pkills[8]++;
else
ch->pcdata->clan->pkills[9]++;
}
[/code]

What that does is breaks your level spread up into 10 more or less equally spaced groups. We're ignoring the obvious problem of rounding errors here. It's not meant to be perfect. But what that does is later allows you to increase MAX_LEVEL ( which in turn affects ALL of the other defines, including LEVEL_AVATAR ) and not have to come back later and change all these kinds of functions.
       
Pages:<< prev 1 next >>