Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
tintin++ ogg sound player script for linux
Author: Robert Smith
Submitted by: Vladaar
6Dragons ogg Soundpack
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.4
Author: Vladaar
Submitted by: Vladaar
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
Users Online
CommonCrawl, Yandex, dbnu, Vladaar, joeyfogas

Members: 4
Guests: 7
Stats
Files
Topics
Posts
Members
Newest Member
481
3,734
19,364
618
Micheal64X
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » General » Coding » Custom clan/order/guild ranks...
Forum Rules | Mark all | Recent Posts

Custom clan/order/guild ranks on Who list
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
* #1 Sep 1, 2012, 6:37 pm
Go to the top of the page
Go to the bottom of the page

thatjdguy
Fledgling
GroupMembers
Posts14
JoinedJul 2, 2012

This seems like it should be very simple to accomplish but I've been wracking my brain for hours on this. What I'm trying to do is if a player is the leader or ranking member of a clan/order/guild then the leadrank, onerank, etc. will display in front of the clan/guild/order name instead of in the rank (where level displays). Should look like:

Avatar PlayerName with player title. (Custom Rank of This Clan)

Here's what I've done so far:
In do_who

 else if( !str_cmp (wch->name, pclan->leader ) )
	    {
	       mudstrlcat( clan_leadrank, " ", MAX_INPUT_LENGTH );
	       mudstrlcat( clan_display, "of ", MAX_INPUT_LENGTH );
	    }


Added the first mudstrlcat statement

snprintf( buf, MAX_STRING_LENGTH, "%*s&B[&W%-15s&B]&G%-2s%s%s%s%s%s%s%s.%s%s%s%s\r\n",
                ( fGroup ? whogr->indent : 0 ), "",
                Class,
                invis_str,
                ( wch->desc && wch->desc->connected ) ? "&R[&WWRITING&R]&G " : "",
                xIS_SET( wch->act, PLR_AFK ) ? "&R[&BA&WF&YK&R]&G " : "",
                xIS_SET( wch->act, PLR_ATTACKER ) ? "&R(&WATTACKER&R)&G " : "",
                xIS_SET( wch->act, PLR_KILLER ) ? "&R(&WKILLER&R)&G " : "",
                xIS_SET( wch->act, PLR_THIEF ) ? "&R(&WTHIEF&R)&G " : "",
                char_name, wch->pcdata->title, extra_title, clan_leadrank, clan_display, council_name );


Added a %s for the clan_leadrank. Compiles just fine, but the output of who looks like this:

Avatar PlayerName with player title. ( of This Clan)

Tried adding "test" inside the first mudstrlcat just to see what would happen and it showed:

Avatar Playername with player title.test ( of This Clan)

I'm pretty sure it's got something to do with the bottom section of code, I just have no idea what.
       
Post is unread #2 Sep 3, 2012, 9:02 am
Go to the top of the page
Go to the bottom of the page

Kasji
Apprentice
GroupMembers
Posts62
JoinedDec 23, 2007

I don't have a copy of Smaug handy, but as near as I can tell, you need to do this (forgive my psuedo code):
    if (!str_cmp(wch->name, pclan->leader))
        snprintf(clan_display, MAX_STRING_LENGTH, "(%s of %s)", pclan->leader_rank, pclan->name);
    else if (!str_cmp(wch->name, pclan->first))
        snprintf(clan_display, MAX_STRING_LENGTH, "(%s of %s)", pclan->first_rank, pclan->name);
    else if (!str_cmp(wch->name, pclan->second))
        snprintf(clan_display, MAX_STRING_LENGTH, "(%s of %s)", pclan->second_rank, pclan->name);
    else
        snprintf(clan_display, MAX_STRING_LENGTH, "(%s)", pclan->name);

That's how I'd probably do it.
       
Post is unread #3 Sep 4, 2012, 11:26 am
Go to the top of the page
Go to the bottom of the page

thatjdguy
Fledgling
GroupMembers
Posts14
JoinedJul 2, 2012

Thanks for the reply, but I actually got it working a couple days ago. Just forgot to update the post here with it. For anyone else looking to do the same, here's what I did.

 else if( !str_cmp (wch->name, pclan->leader ) )
	    {
	       mudstrlcat( clan_display, pclan->leadrank, MAX_INPUT_LENGTH );
	       mudstrlcat( clan_display, "of ", MAX_INPUT_LENGTH );
	    }


I previously tried with snprintf like you suggested but it still wasn't giving me the output I wanted. Probably due to the snprintf statement below it where the actual class, name, title, clan, etc. are displayed. I'm sure there's a better way to write the whole thing, but I'm not ready to attempt that yet.

Note that I did make a new field in pcdata->clan for display so that the clan names could accept color without having to use the color codes when doing setclan. Clan_display simply takes the place of clan_name for all fields in the who display.
       
Pages:<< prev 1 next >>