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, 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.
 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ Spacing issues [FIXED]

Spacing issues [FIXED]

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


Posted by Findecano_Elendil   United Kingdom  (9 posts)  Bio
Date Thu 09 Jul 2009 06:37 PM (UTC)
Message
Ok this ones abit weird as its not an issue what is loading etc, more of a display issue I cant seem to put my thing on...

Basically my mud has a 'family name' system so that people can become part of a family and have a few other features too... however.

I have an issue with the display of do_who and show_char_to_char_0

The problem lies that it seems to be joining the characters name with their family name for example it displayers this:
(Immortal) FindecanoElendil, the Dreamer is here before you.

Now, this works fine if I just set the players family name, so if I typed 'mset findecano family Elendil'
It will then display correctly.. so it seems to only happen when the character has closed its connection to the mud. And then reloaded on the mud... so reading the data from the pfile.

I guess, im just curious if anyone has had this problem before as I just cant put my finger on what could be causing it. Cheers for any help, its probably just me being dumb =)
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #1 on Thu 09 Jul 2009 08:59 PM (UTC)
Message
Can you show us the lines that append family name and name into a string?

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

Posted by Findecano_Elendil   United Kingdom  (9 posts)  Bio
Date Reply #2 on Thu 09 Jul 2009 10:45 PM (UTC)

Amended on Thu 09 Jul 2009 10:48 PM (UTC) by Findecano_Elendil

Message
Yep, I can do that =)

act_info.c under 'show_char_to_char_0'

   if ( victim->pcdata->family && !IS_NPC ( victim) )
      mudstrlcat( buf, victim->pcdata->family, MAX_STRING_LENGTH );
  
   if( !IS_NPC( victim ) && !xIS_SET( ch->act, PLR_BRIEF ) )
      mudstrlcat( buf, victim->pcdata->title, MAX_STRING_LENGTH );


This prints out the family name before the title..

and then act_info.c under 'do_who'

      snprintf( buf, MAX_STRING_LENGTH, "%*s%-15s%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 ) ? "&z[&WWRITING&w]&D " : "",
                xIS_SET( wch->act, PLR_AFK ) ? "&z[&WAFK&z]&D " : "",
                xIS_SET( wch->act, PLR_ATTACKER ) ? "&g(&GATTACKER&g)&D " : "",
                xIS_SET( wch->act, PLR_KILLER ) ? "&r(&RKILLER&r)&D " : "",
                xIS_SET( wch->act, PLR_THIEF ) ? "&g(&GTHIEF&g)&D " : "",
                char_name, wch->pcdata->family, wch->pcdata->title, extra_title, clan_name, council_name );


Now I can cheat... and put a space in there, however it doesn't resolve the under-lying problem... because when the family name is created, the people then have two spaces instead.

Family name is pretty much just a basic char inside pc_data, which is similar to the 'title' I guess... however, there seems to be something i might have missed? I'm not to sure.

Top

Posted by Nick Gammon   Australia  (23,070 posts)  Bio   Forum Administrator
Date Reply #3 on Thu 09 Jul 2009 11:47 PM (UTC)
Message
Your basic problem is that you are not saving (or reading back in perhaps) what the variable initially had in it. So if you make a new family name the variable wch->pcdata->family contains "Elendil " (or " Elendil" perhaps?), but when written to disk the space is dropped. Or perhaps, the space is on the pfile, but it is dropped when reading back in. Inspecting the pfile should show you which.

I think your easiest solution is to make the wch->pcdata->family contain the family name without spaces (for example, you may want to put a comma after it). Then just amend your displays to insert the space where required. This probably requires simply removing extra leading or trailing spaces on the command they use to set their family name.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Findecano_Elendil   United Kingdom  (9 posts)  Bio
Date Reply #4 on Fri 10 Jul 2009 03:10 PM (UTC)

Amended on Fri 10 Jul 2009 03:11 PM (UTC) by Findecano_Elendil

Message
Cheers Nick & Zeno,
Some reason I couldn't just put my finger on it... ended up having to add this to save.c

if( !strcmp( word, "Family" ) )   
{
   ch->pcdata->family = fread_string( fp );
   if( isalpha( ch->pcdata->family[0] ) || isdigit( ch->pcdata->family[0] ) )
   {
       snprintf( buf, MAX_STRING_LENGTH, " %s", ch->pcdata->family );
          if( ch->pcdata->family )
             STRFREE( ch->pcdata->family );
          ch->pcdata->family = STRALLOC( buf );
    }
             fMatch = TRUE;
             break;
}
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.


16,496 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.