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 ➜ question reguarding classes SmaugFUSS1.9

question reguarding classes SmaugFUSS1.9

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


Posted by SirRoughknight   (19 posts)  Bio
Date Mon 18 Jan 2010 09:10 AM (UTC)
Message
I've looked everywhere I can think of in the source code to find out where in SmaugFUSS1.9 it defaults to class 3 if no class is chosen during the initial nanny functions when creating a new character.

I commented out the nanny_get_new_class/race functions to skip straight to the nanny_get_want_ripansi and have a mobile in the start area to change class/races

But it defaults them to class 3 automatically, which isn't the class I want it to default them to.

I realize I could switch the class numbers around to the desired class, but if someone wouldn't mind taking the time to show me where it handles that in the code I'd appreciate it.

I haven't been very successful in locating it, and it just seems odd that it defaults to race 0, and class 3... atleast to me. I'd like to see where and how in the code it handles that.
Top

Posted by Nick Gammon   Australia  (23,169 posts)  Bio   Forum Administrator
Date Reply #1 on Mon 18 Jan 2010 07:46 PM (UTC)
Message
Where do you see a default class? When I make a new character under SmaugFUSS 1.9 this is what I see:


SmaugFUSS 1.9 changes by Samson. Other bugfixes and changes provided by
various members of the SMAUG community. Their contributions are greatly
appreciated.
SMAUG 1.4 written by Thoric (Derek Snider) with Altrag, Blodkai, Haus, Narn,
Scryn, Swordbearer, Tricops, Gorog, Rennard, Grishnakh, Fireblade and Nivek.
Original MERC 2.1 code by Hatchet, Furey, and Kahn.
Original DikuMUD code by:
Hans Staerfeldt, Katja Nyboe, Tom Madsen, Michael Seifert & Sebastian Hammer

Enter your character's name, or type new: new

Choosing a name is one of the most important parts of this game...
Make sure to pick a name appropriate to the character you are going
to role play, and be sure that it suits a medieval theme.
If the name you select is not acceptable, you will be asked to choose
another one.

Please choose a name for your character: nick
Did I get that right, Nick (Y/N)? y

Make sure to use a password that won't be easily guessed by someone else.
Pick a good password for Nick: xxxxx

Please retype the password to confirm: xxxxx

What is your sex (M/F/N)? m

Select a class, or type help [class] to learn more about that class.
[Mage Cleric Thief Warrior Vampire Druid Ranger Augurer Paladin]
:


There is nothing there about defaulting to class 3, and it doesn't accept your just hitting <enter> - you have to choose one.

- Nick Gammon

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

Posted by SirRoughknight   (19 posts)  Bio
Date Reply #2 on Tue 19 Jan 2010 03:36 AM (UTC)

Amended on Tue 19 Jan 2010 03:41 AM (UTC) by SirRoughknight

Message
I mentioned I commented this out in comm.c


/*
char buf[MAX_STRING_LENGTH];
    int IClass;
*/

and...

/*
   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' )
      {
         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 buf[MAX_STRING_LENGTH];
   char arg[MAX_STRING_LENGTH];
   int iClass, iRace;

   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' || !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;
   }

   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'
          && !IS_SET( race_table[iRace]->class_restriction, 1 << ch->Class )
          && 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;
   }
*/

and...

/*
case CON_GET_NEW_CLASS:
   nanny_get_new_class( d, argument )
   break;
  
case CON_GET_NEW_RACE:
   nanny_get_new_race( d, argument );
   break;
 */


And have a mobile in the area to set the class and race to the desired ones... but even so, on creation... when you mstat the new player their race is 0 and their class is 3.

I was wondering why it choose 3 for class under these circumstances instead of 0 like race.

I did notice it was the same when you created a new mobile with mcreate, it sets the race to 0 and class to 3 automatically.
Top

Posted by Samson   USA  (683 posts)  Bio
Date Reply #3 on Tue 19 Jan 2010 10:53 AM (UTC)
Message
The function clear_char() in db.c is what you want to look at. In there, race is initialized to 0 and class is initialized to 3.
Top

Posted by SirRoughknight   (19 posts)  Bio
Date Reply #4 on Fri 22 Jan 2010 07:35 AM (UTC)
Message
Ah, sorry for the delay. Had to go out of town for a few days.

Thank you very much Samson, I was very pleased to come home and see your response. You've been most helpful.
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.


20,386 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.