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 ➜ Custom leader ranks on Who list

Custom leader ranks on Who list

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


Posted by Rhayne   (14 posts)  Bio
Date Sun 02 Sep 2012 12:18 AM (UTC)
Message
I'm trying to make it so that leadrank, onerank, tworank show on do_who before the clan name. Ex: (I am the Leader of This Clan). While this seems like a relatively simple thing to do it has been giving me a headache for quite a while now.

What I've done so far:


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 which should display the custom rank and:


else
         invis_str[0] = '\0';
      snprintf( buf, MAX_STRING_LENGTH, "%*s&B[&W%-15s&B]&G%-2s%s%s%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_onerank, clan_tworank , clan_display, council_name );


Added the leadrank, onerank, tworank to the output. To me it looks like it should be working, but when typing who it displays as: Player. I am the Leader( of This Clan).

I'm pretty sure the problem lies in the bottom code with the leadrank, onerank, etc. but I have no idea what to do to fix this. Any help is appreciated.
Top

Posted by Fiendish   USA  (2,555 posts)  Bio   Global Moderator
Date Reply #1 on Sun 02 Sep 2012 08:38 PM (UTC)

Amended on Sun 02 Sep 2012 08:39 PM (UTC) by Fiendish

Message
I'm guessing the problem here is that the open parenthesis is in the wrong place? As there appear to be no literal parentheses in that snprintf line, I believe you are incorrect. You should inspect the values of clan_leadrank and clan_display before and after you run those mudstrlcats in the first part.

If parenthesis placement is not the issue, please elaborate on the problem you see.

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Rhayne   (14 posts)  Bio
Date Reply #2 on Mon 03 Sep 2012 05:51 AM (UTC)
Message
Not completely certain, but I don't think the problem lies in the parentheses placement. Here's the entire first section of code for a little better clarification.


      else if( wch->pcdata->clan
               && !str_cmp( wch->name, wch->pcdata->clan->leader ) && wch->pcdata->clan->leadrank[0] != '\0' )
         Class = wch->pcdata->clan->leadrank;
      else if( wch->pcdata->clan
               && !str_cmp( wch->name, wch->pcdata->clan->number1 ) && wch->pcdata->clan->onerank[0] != '\0' )
         Class = wch->pcdata->clan->onerank;
      else if( wch->pcdata->clan
               && !str_cmp( wch->name, wch->pcdata->clan->number2 ) && wch->pcdata->clan->tworank[0] != '\0' )
         Class = wch->pcdata->clan->tworank;
      else if( wch->pcdata->rank && wch->pcdata->rank[0] != '\0' )
         Class = wch->pcdata->rank;

      if( wch->pcdata->clan )
      {
         CLAN_DATA *pclan = wch->pcdata->clan;
         if( pclan->clan_type == CLAN_GUILD )
            mudstrlcpy( clan_display, " <", MAX_INPUT_LENGTH );
         else
            mudstrlcpy( clan_display, " (", MAX_INPUT_LENGTH );

         if( pclan->clan_type == CLAN_ORDER )
         {
            if( !str_cmp( wch->name, pclan->deity ) )
               mudstrlcat( clan_display, "Deity, Order of ", MAX_INPUT_LENGTH );
            else if( !str_cmp( wch->name, pclan->leader ) )
               mudstrlcat( clan_display, "Leader, Order of ", MAX_INPUT_LENGTH );
            else if( !str_cmp( wch->name, pclan->number1 ) )
               mudstrlcat( clan_display, "Number One, Order of ", MAX_INPUT_LENGTH );
            else if( !str_cmp( wch->name, pclan->number2 ) )
               mudstrlcat( clan_display, "Number Two, Order of ", MAX_INPUT_LENGTH );
            else
               mudstrlcat( clan_display, "Order of ", MAX_INPUT_LENGTH );
         }
         else if( pclan->clan_type == CLAN_GUILD )
         {
            if( !str_cmp( wch->name, pclan->leader ) )
               mudstrlcat( clan_display, "Leader, ", MAX_INPUT_LENGTH );
            if( !str_cmp( wch->name, pclan->number1 ) )
               mudstrlcat( clan_display, "First, ", MAX_INPUT_LENGTH );
            if( !str_cmp( wch->name, pclan->number2 ) )
               mudstrlcat( clan_display, "Second, ", MAX_INPUT_LENGTH );
         }
         else
         {
            if( !str_cmp( wch->name, pclan->deity ) )
               mudstrlcat( clan_display, "Deity of ", MAX_INPUT_LENGTH );
            else if( !str_cmp (wch->name, pclan->leader ) )
	       {
	          mudstrlcat( clan_leadrank, " ", MAX_INPUT_LENGTH );
	          mudstrlcat( clan_display, " of ", MAX_INPUT_LENGTH );
	       }
            else if( !str_cmp( wch->name, pclan->number1 ) )
               mudstrlcat( clan_display, "Number One of ", MAX_INPUT_LENGTH );
            else if( !str_cmp( wch->name, pclan->number2 ) )
               mudstrlcat( clan_display, "Number Two of ", MAX_INPUT_LENGTH );
         }
         mudstrlcat( clan_display, pclan->display, MAX_INPUT_LENGTH );
         if( pclan->clan_type == CLAN_GUILD )
            mudstrlcat( clan_display, ">", MAX_INPUT_LENGTH );
         else
            mudstrlcat( clan_display, ")", MAX_INPUT_LENGTH );
      }
      else
         clan_display[0] = '\0';
Top

Posted by Rhayne   (14 posts)  Bio
Date Reply #3 on Mon 03 Sep 2012 06:23 AM (UTC)

Amended on Mon 03 Sep 2012 06:25 AM (UTC) by Rhayne

Message
Note that the only one I'm trying to replace in that code is in the Clans (not Orders or Guilds) as I'm sure if I can get it working there it will work for the others as well. I did notice that with the stock FUSS it places the custom leadranks in Class which makes it display as:

CustomRank Playername and title. (Leader of This Clan)

Seems like it would be a simple move but it's frustrating the hell out of me.
Top

Posted by Fiendish   USA  (2,555 posts)  Bio   Global Moderator
Date Reply #4 on Mon 03 Sep 2012 03:50 PM (UTC)

Amended on Mon 03 Sep 2012 03:52 PM (UTC) by Fiendish

Message
Rhayne said:
Not completely certain, but I don't think the problem lies in the parentheses placement.

Then you need to clarify what your problem is, because what you said is...

Quote:
I'm trying to ... (I am the Leader of This Clan).

Quote:
but when typing who... I am the Leader( of This Clan).


Explain to me how that isn't just a parenthesis being out of place in your output.

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Rhayne   (14 posts)  Bio
Date Reply #5 on Mon 03 Sep 2012 04:03 PM (UTC)
Message
The reason I'm unsure that the problem lies with the parentheses placement is that I'm new to coding so I'm leaving open the possibility that I'm wrong in that. The reason that I don't think it's the parentheses placement is because


      if( wch->pcdata->clan )
      {
         CLAN_DATA *pclan = wch->pcdata->clan;
         if( pclan->clan_type == CLAN_GUILD )
            mudstrlcpy( clan_display, " <", MAX_INPUT_LENGTH );
         else
            mudstrlcpy( clan_display, " (", MAX_INPUT_LENGTH );

         if( pclan->clan_type == CLAN_ORDER )


comes before and contains


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

Posted by Fiendish   USA  (2,555 posts)  Bio   Global Moderator
Date Reply #6 on Mon 03 Sep 2012 07:06 PM (UTC)

Amended on Mon 03 Sep 2012 07:08 PM (UTC) by Fiendish

Message
Quote:
The reason that I don't think it's the parentheses placement is because

And yet the only apparent difference between what you said you want and what you said you're getting is that the "(" is in the wrong location. So I'm going to suggest again that you inspect the values of clan_leadrank and clan_display before and after you run those mudstrlcats. Maybe then the problem will become clear to you.

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Rhayne   (14 posts)  Bio
Date Reply #7 on Mon 03 Sep 2012 10:07 PM (UTC)
Message
I finally fixed it. Made me facepalm at how completely stupid I was being up until this point.


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


And I never moved the parentheses XD
Top

Posted by Fiendish   USA  (2,555 posts)  Bio   Global Moderator
Date Reply #8 on Tue 04 Sep 2012 01:23 AM (UTC)
Message
Quote:
And I never moved the parentheses XD

I'm glad you solved your problem. This means, though, that you didn't describe the problem accurately. :\

https://github.com/fiendish/aardwolfclientpackage
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.


27,105 views.

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.