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
➜ Null Titles
It is now over 60 days since the last post. This thread is closed.
Refresh page
Pages: 1
2
| Posted by
| David Haley
USA (3,881 posts) Bio
|
| Date
| Reply #15 on Wed 26 Apr 2006 02:58 AM (UTC) |
| Message
| | Well, the easiest thing to do at this point is to just print to log the value of "buf". I think the command would be something like: log_string(buf). |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | | Top |
|
| Posted by
| Malti
USA (55 posts) Bio
|
| Date
| Reply #16 on Wed 26 Apr 2006 08:50 PM (UTC) |
| Message
| | I get "Log: (null)" and in the nanny its also says "(null)". Is there anyway to find out what the character at [0] is? I think this could helpme. I tried using log_buff( buf[0] ), but it does not allow it. | | Top |
|
| Posted by
| David Haley
USA (3,881 posts) Bio
|
| Date
| Reply #17 on Wed 26 Apr 2006 09:19 PM (UTC) |
| Message
| OK, here's something I note: in my version of SMAUG, which is admittedly quite different from yours, set_title is called in nanny when the character is created/authed. The title is then set to "the %s".
Maybe your code also has more references to set_title outside of advance_level, in which case you'll have to hunt them down and introduce a similar check that you have inside advance_level. |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | | Top |
|
| Posted by
| Malti
USA (55 posts) Bio
|
| Date
| Reply #18 on Wed 26 Apr 2006 10:18 PM (UTC) Amended on Wed 26 Apr 2006 10:19 PM (UTC) by Malti
|
| Message
|
void advance_level( CHAR_DATA * ch )
{
char buf[MAX_STRING_LENGTH];
int add_hp;
int add_mana;
int add_move;
int add_prac;
snprintf( buf, MAX_STRING_LENGTH, "%s" ,title_table[ch->Class][ch->level][ch->sex == SEX_FEMALE ? 1 : 0] );
if (buf[0] != '(')
set_title(ch, buf );
add_hp = con_app[get_curr_con( ch )].hitp + number_range( class_table[ch->Class]->hp_min,
class_table[ch->Class]->hp_max );
add_mana = class_table[ch->Class]->fMana ? number_range( 2, ( 2 * get_curr_int( ch ) + get_curr_wis( ch ) ) / 8 ) : 0;
add_move = number_range( 5, ( get_curr_con( ch ) + get_curr_dex( ch ) ) / 4 );
add_prac = wis_app[get_curr_wis( ch )].practice;
add_hp = UMAX( 1, add_hp );
add_mana = UMAX( 0, add_mana );
add_move = UMAX( 10, add_move );
.....
and
void set_title( CHAR_DATA * ch, char *title )
{
char buf[MAX_STRING_LENGTH];
if( IS_NPC( ch ) )
{
bug( "%s", "Set_title: NPC." );
return;
}
if( isalpha( title[0] ) || isdigit( title[0] ) )
{
buf[0] = ' ';
mudstrlcpy( buf + 1, title, MAX_STRING_LENGTH - 1 );
}
else
{
mudstrlcpy( buf, title, MAX_STRING_LENGTH );
}
if( str_cmp( buf, " the (null)" ) != 0 )
{
STRFREE( ch->pcdata->title );
ch->pcdata->title = STRALLOC( buf );
}
return;
}
This code fixed my problem. Thanks for all the help! | | Top |
|
| Posted by
| David Haley
USA (3,881 posts) Bio
|
| Date
| Reply #19 on Wed 26 Apr 2006 10:35 PM (UTC) |
| Message
| | Well, be careful; now you can't have class titles that start with a parenthesis. You probably won't have any, but it's good to keep in mind... but it's good that at least the basics are working! :) |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | | Top |
|
| Posted by
| Malti
USA (55 posts) Bio
|
| Date
| Reply #20 on Wed 26 Apr 2006 10:59 PM (UTC) |
| Message
| point well taken, but i could just use the following
if( str_cmp( buf, "(null)" ) != 0 )
and that should allow titles with parentheses. For my mud, players will recieve titles based off of thier class and completion of quests. I choose to do it this way becuase when i logged into 'Realms of Dispair', people had non-rping titles. Seriously, there were things like 'is a smelly butt' and other rediculous titles. Kind of ruins the point of titles in my opinion. | | 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.
68,329 views.
This is page 2, subject is 2 pages long:
1
2
It is now over 60 days since the last post. This thread is closed.
Refresh page
top