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, Google, Yandex

Members: 0
Guests: 8
Stats
Files
Topics
Posts
Members
Newest Member
481
3,734
19,366
618
Micheal64X
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » General » Coding » races b4 class character crea...
Forum Rules | Mark all | Recent Posts

races b4 class character creation prompt
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Jan 27, 2010, 5:39 pm   Last edited Jan 28, 2010, 1:31 pm by Kayle
Go to the top of the page
Go to the bottom of the page

lain_noskire
Fledgling
GroupMembers
Posts6
JoinedJan 24, 2010

List of things to do:
1. Find stock codebases that will compile...Done
2. Pick one that has features that I want (built in editors, simple race system, simple class system)...Done
2.a. Alter code further to fit desires...In progress:



   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(race_table[iRace]->race_name && race_table[iRace]->race_name[0] != '\0'
        &&  iRace != RACE_VAMPIRE)
      {
         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 buf[MAX_STRING_LENGTH];
   char arg[MAX_STRING_LENGTH];
   int iRace, iClass;

   ch = d->character;
   argument = one_argument( argument, arg );

   if( !str_cmp( arg, "help" ) )
   {

      for( iRace = 0; iRace < MAX_PC_RACE; iRace++ )
      {
         if( race_table[iRace]->race_name && race_table[iRace]->race_name[0] != '\0' )
         {
            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( race_table[iRace]->race_name && race_table[iRace]->race_name[0] != '\0' )
      {
         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
       || iRace == RACE_VAMPIRE
       || race_table[iRace]->race_name[0] == '\0' || !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;
   }

   write_to_buffer( d, "\r\nSelect a class, or type help [class] to learn more about that class.\r\n[", 0 );
   buf[0] = '\0';

   for( iClass = 0; iClass < MAX_PC_CLASS; iClass++ )
   {
      if( class_table[iClass]->who_name && class_table[iClass]->who_name[0] != '\0' 
        && !IS_SET( race_table[iClass]->class_restriction, 1 << ch->Class )
        && str_cmp( class_table[iClass]->who_name, "unused" ))
      {
         if( iClass > 0 )
         {
            if( strlen( buf ) + strlen( class_table[iClass]->who_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, class_table[iClass]->who_name, MAX_STRING_LENGTH );
      }
   }
   mudstrlcat( buf, "]\r\n: ", MAX_STRING_LENGTH );
   write_to_buffer( d, buf, 0 );
   d->connected = CON_GET_NEW_CLASS;   
}

void nanny_get_new_class( DESCRIPTOR_DATA * d, const char *argument )
{
   CHAR_DATA *ch;
   char arg[MAX_STRING_LENGTH];
   int iClass;

   ch = d->character;
   argument = one_argument( argument, arg );

   if( !str_cmp( arg, "help" ) )
   {

      for( iClass = 0; iClass < MAX_PC_CLASS; iClass++ )
      {
         if( class_table[iClass]->who_name && class_table[iClass]->who_name[0] != '\0' )
         {
            if( toupper( argument[0] ) == toupper( class_table[iClass]->who_name[0] )
                && !str_prefix( argument, class_table[iClass]->who_name ) )
            {
               do_help( ch, argument );
               write_to_buffer( d, "Please choose a class: ", 0 );
               return;
            }
         }
      }
      write_to_buffer( d, "No such help topic.  Please choose a class: ", 0 );
      return;
   }

   for( iClass = 0; iClass < MAX_PC_CLASS; iClass++ )
   {
      if( class_table[iClass]->who_name && class_table[iClass]->who_name[0] != '\0' )
      {
         if( toupper( arg[0] ) == toupper( class_table[iClass]->who_name[0] )
             && !str_prefix( arg, class_table[iClass]->who_name ) )
         {
            ch->Class = iClass;
            break;
         }
      }
   }

   if( iClass == MAX_PC_CLASS
       || !class_table[iClass]->who_name
       || class_table[iClass]->who_name[0] == '\0'
       || IS_SET( race_table[iClass]->class_restriction, 1 << ch->Class )
       || !str_cmp( class_table[iClass]->who_name, "unused" ) )
   {
      write_to_buffer( d, "That's not a class.\r\nWhat IS your class? ", 0 );
      return;
   }


   if( check_bans( ch, BAN_CLASS ) )
   {
      write_to_buffer( d, "That class is not currently avaiable.\r\nWhat IS your class? ", 0 );
      return;
   }

It's sorta working. Just not displaying right.

[Edit by Kayle:] Removed the spoiler tags. Post is readable now.
       
Post is unread #2 Jan 27, 2010, 5:41 pm   Last edited Jan 27, 2010, 7:58 pm by lain_noskire
Go to the top of the page
Go to the bottom of the page

lain_noskire
Fledgling
GroupMembers
Posts6
JoinedJan 24, 2010

and i just had a n00b moment and didn't set the font color for the last post. and i pick any race i want and any class it shows...so now i need it to make it limit the classes instead of races...
       
Post is unread #3 Jan 28, 2010, 11:05 am
Go to the top of the page
Go to the bottom of the page

David Haley
Sorcerer
GroupMembers
Posts903
JoinedJan 29, 2007

Sorry, I'm not sure if this is a question or a status update?
       
Pages:<< prev 1 next >>