Okay. So I changed the order around, and then had to move a few things like where it prompts for rip/ansi/no color. It appears to work, asks for race first, lists the races appropriately. But then it would only allow you to pick one race. Any other choices and it would return with "that is not a race". So I commented out the class restriction line to see if that was interfering with it. But now it wont accept any of the choices, and returns with "that is not a race" no matter what is typed in. Heres the code, although its a little lengthy i left in the section before it so you could see if theres something out of place that Im not seeing. At the end of this starts the void nanny_get_new_class section.
void nanny_get_new_sex( DESCRIPTOR_DATA * d, char *argument )
{
CHAR_DATA *ch;
char buf[MAX_STRING_LENGTH];
int iRace;
ch = d->character;
switch ( argument[0] )
{
case 'm':
case 'M':
ch->sex = SEX_MALE;
break;
case 'f':
case 'F':
ch->sex = SEX_FEMALE;
break;
default:
write_to_buffer( d, "That's not a sex.\r\nWhat IS your sex? ", 0 );
return;
}
write_to_buffer( d, "\r\nYou may choose from the following races, or type help [race] to learn more:\r\n[", 0 );
buf[0] = '\0';
for( iRace = 0; iRace < MAX_PC_RACE; iRace++ )
{
if( iRace != RACE_VAMPIRE
&& race_table[iRace]->race_name && race_table[iRace]->race_name[0] != '\0'
&& str_cmp( race_table[iRace]->race_name, "unused" ) )
{
if( iRace > 0 )
{
if( strlen( buf ) + strlen( race_table[iRace]->race_name ) > 77 )
{
mudstrlcat( buf, "\r\n", MAX_STRING_LENGTH );
write_to_buffer( d, buf, 0 );
buf[0] = '\0';
}
else
mudstrlcat( buf, " ", MAX_STRING_LENGTH );
}
mudstrlcat( buf, race_table[iRace]->race_name, MAX_STRING_LENGTH );
}
}
mudstrlcat( buf, "]\r\n: ", MAX_STRING_LENGTH );
write_to_buffer( d, buf, 0 );
d->connected = CON_GET_NEW_RACE;
}
void nanny_get_new_race( DESCRIPTOR_DATA * d, const char *argument )
{
CHAR_DATA *ch;
char arg[MAX_STRING_LENGTH];
int iRace;
ch = d->character;
argument = one_argument( argument, arg );
if( !str_cmp( arg, "help" ) )
{
for( iRace = 0; iRace < MAX_PC_RACE; iRace++ )
{
if( toupper( argument[0] ) == toupper( race_table[iRace]->race_name[0] )
&& !str_prefix( argument, race_table[iRace]->race_name ) )
{
do_help( ch, argument );
write_to_buffer( d, "Please choose a race: ", 0 );
return;
}
}
write_to_buffer( d, "No help on that topic. Please choose a race: ", 0 );
return;
}
for( iRace = 0; iRace < MAX_PC_RACE; iRace++ )
{
if( toupper( arg[0] ) == toupper( race_table[iRace]->race_name[0] )
&& !str_prefix( arg, race_table[iRace]->race_name ) )
{
ch->race = iRace;
break;
}
}
if( iRace == MAX_PC_RACE
|| !race_table[iRace]->race_name || race_table[iRace]->race_name[0] == '\0'
/*|| iRace == RACE_VAMPIRE */
/*|| IS_SET( race_table[iRace]->class_restriction, 1 << ch->Class ) */
|| !str_cmp( race_table[iRace]->race_name, "unused" ) )
{
write_to_buffer( d, "That's not a race.\r\nWhat IS your race? ", 0 );
return;
}
if( check_bans( ch, BAN_RACE ) )
{
write_to_buffer( d, "That race is not currently available.\r\nWhat is your race? ", 0 );
return;
}
}
|