Login
User Name:

Password:



Register

Forgot your password?
do_owhere recursive
Author: Khonsu
Submitted by: Khonsu
Changes list / Addchange
Author: Khonsu
Submitted by: Khonsu
6Dragons mp3 sound pack
Author: Vladaar
Submitted by: Vladaar
AFKMud 2.2.3
Author: AFKMud Team
Submitted by: Samson
SWFOTEFUSS 1.5
Author: Various
Submitted by: Samson
Users Online
AhrefsBot, Yandex

Members: 0
Guests: 9
Stats
Files
Topics
Posts
Members
Newest Member
489
3,794
19,649
596
Elwood

Today's Birthdays
There are no member birthdays today.
» SmaugMuds » Codebases » SmaugFUSS » Problems with changing Charac...
Forum Rules | Mark all | Recent Posts

Problems with changing Character Creation
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Jun 29, 2009 10:18 am   
Go to the top of the page
Go to the bottom of the page

paradox24
Fledgling
GroupMembers
Posts18
JoinedMar 6, 2009

 
Hey all,

I'm at work now, but in a few minutes I'll edit this post to include part of the actual source code I've been working with, but for now let me explain the problem until the email arrives with it so I can copy/paste :P

I have previously modified the character creation to include a Terms and Conditions and a pet selection .. so it goes like this (I dont have classes any longer, so it was removed btw)

Name -> Confirm Name -> Password -> Confirm Password -> Pet Selection -> Race Selection -> Terms and Conditions -> Press Enter -> MOTD -> into the game

now I'm redesigning it and trying to add some new features .. so I've added 4 new selections .. which actually spread across 9 subroutines .. but I'll explain that quickly

it now goes something like this..

Name -> Confirm Name -> Password -> Confirm Password -> Pet Selection -> Race Selection -> Eye colour -> Hair Colour -> Summon Animal -> Aptitude Question 1 -> Aptitude Questin 2 -> Aptitude Question 3 -> Aptitude Question 4 -> Aptitude Question 5 -> Terms and Conditions -> Press Enter -> MOTD -> into the game

or atleast that's how its supposed to work .. but for some reason it skips all the new content I added and after race selection goes straight to terms and conditions .. it is noteworthy to mention that even tho I've added the 4 new write_to_buffer lines in nanny_get_new_race() they do not display as well.. I thought originally I hadn't configured it properly and it was skipping over everythign w/o a pause .. but no information new is displayed ..

Again, I'll be positng the source code from comm.c as soon as I get it.. but to clarify beforehand, here's the format I've been using...

Add a CON_GET_STATE to mud.h
Add a if( d->connected = CON_GET_STATE )
nanny_get_state( d, argument );
In the subroutine BEFORE the new one, at the end, make d->connected = CON_GET_STATE .. and add the write_to_buffer( d, " ...", 0 ); w/e the question is
then make the new nanny_get_state() subroutine which basically just assigns ch to d->connected does a switch() for the arg[0] of the question .. default: to repeat question .. and if/when they provide a correct answer, just set the ch->variable to what I want, and break out of the switch.. and rinse repeat (ptuting the new question at the bottom .. new con_get_state etc etc

I believe this to be all I need to do .. and again am baffled by why if I modified the information displayed at the end of nanny_get_new_race() to display a new question and not the terms and conditions (which are now at the end of aptitude question 5) .. why it wouldn't affect the game at all..

just to stop you from thinking I'm a complete idiot.. yes I have recompiled .. yes I have shutdown the mud and rebooted .. yes I have triple checked that I was in the right directory and spawning the correct version of the game .. etc etc .. I've gone over my mud.h and comm.c files a million times.. and the order is correct etc etc.. and the CON_STATES exists in mud.h as I think they should.. it compiles fine now.. just doesn't seem to affect the output to the game at all.. no clue why..

if you have any suggestions please feel free.. otherwise I'll be posting the source code in a few minutes.. thanks in advance all !

Post is unread #2 Jun 29, 2009 12:35 pm   
Go to the top of the page
Go to the bottom of the page

paradox24
Fledgling
GroupMembers
Posts18
JoinedMar 6, 2009

 
OK, here's the code .. I've included the nanny_get_new_race() and the one it SHOULD call below it being nanny_get_eye_colour() ... just to reiterate .. after picking a valid race , it does what it USED to do and reads the terms and conditions which is now like 6 steps beyond it .. I have no idea why my changes aren't taking effect .. any help appreciated :P
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;
   }
   
   
   	write_to_buffer( d, "\r\nWhat colour are your eyes?\r\n\r\n", 0 );
   	write_to_buffer( d, "[ Midnight (B)lue ] [ (I)ce Blue ] [ Emerald (G)reen ]\r\n", 0 );
   	write_to_buffer( d, "[ (F)orest Green ] [ (H)azel ] [ Fiery (R)ed ]\r\n", 0 );
   	write_to_buffer( d, "[ (C)harcoal Black ] [ Snow (W)hite ]\r\n", 0 );
	d->connected = CON_GET_EYE_COLOUR;
}

void nanny_get_eye_colour( DESCRIPTOR_DATA * d, const char *argument )
{
	CHAR_DATA *ch;
	char arg[MAX_INPUT_LENGTH];

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

	switch( arg[0] )
	{
		case 'b':
		case 'B':
		ch->eyecolour = EYE_MIDNIGHT_BLUE;
		break;

		case 'i':
		case 'I':
		ch->eyecolour = EYE_ICE_BLUE;
		break;

		case 'g':
		case 'G':
		ch->eyecolour = EYE_EMERALD_GREEN;
		break;

		case 'f':
		case 'F':
		ch->eyecolour = EYE_FOREST_GREEN;
		break;
		
		case 'h':
		case 'H':
		ch->eyecolour = EYE_HAZEL;
		break;
		
		case 'r':
		case 'R':
		ch->eyecolour = EYE_FIERY_RED;
		break;
		
		case 'c':
		case 'C':
		ch->eyecolour = EYE_CHARCOAL_BLACK;
		break;
		
		case 'w':
		case 'W':
		ch->eyecolour = EYE_SNOW_WHITE;
		break;

		default:
		write_to_buffer( d, "\r\nThat is not a valid eye colour\r\n\r\n", 0 );
	   	write_to_buffer( d, "[ Midnight (B)lue ] [ (I)ce Blue ] [ Emerald (G)reen ]\r\n", 0 );
	   	write_to_buffer( d, "[ (F)orest Green ] [ (H)azel ] [ Fiery (R)ed ]\r\n", 0 );
	   	write_to_buffer( d, "[ (C)harcoal Black ] [ Snow (W)hite ]\r\n", 0 );
		return;
	}

		write_to_buffer( d, "\r\nWhat is your hair colour?\r\n\r\n", 0 );
		write_to_buffer( d, "[ (B)rown ] [ B(l)ack ] [ (W)hite ]\r\n", 0 );
		write_to_buffer( d, "[ Bl(o)nde ] [ (R)ed ] [ (S)ilver ]\r\n", 0 );

   d->connected = CON_GET_HAIR_COLOUR;
}


Post is unread #3 Jun 29, 2009 12:58 pm   
Go to the top of the page
Go to the bottom of the page

Tonitrus
Fledgling
GroupMembers
Posts47
JoinedJun 24, 2009

 
Did you alter nanny() appropriately?

I.e., add new cases to switch( d->connected )?

Even if you have, you should probably include that code too.

Post is unread #4 Jun 29, 2009 1:33 pm   
Go to the top of the page
Go to the bottom of the page

paradox24
Fledgling
GroupMembers
Posts18
JoinedMar 6, 2009

 
yeah I did that .. that's the part where it takes the CON_STATE and tells it which function to call I believe .. here it is anyways in case this is the issue

void nanny( DESCRIPTOR_DATA * d, char *argument )
{
   while( isspace( *argument ) )
      argument++;

   switch ( d->connected )
   {
      default:
         bug( "%s: bad d->connected %d.", __FUNCTION__, d->connected );
         close_socket( d, TRUE );
         return;

      case CON_GET_NAME:
         nanny_get_name( d, argument );
         break;

      case CON_GET_OLD_PASSWORD:
         nanny_get_old_password( d, argument );
         break;

      case CON_CONFIRM_NEW_NAME:
         nanny_confirm_new_name( d, argument );
         break;

      case CON_GET_NEW_PASSWORD:
         nanny_get_new_password( d, argument );
         break;

      case CON_CONFIRM_NEW_PASSWORD:
         nanny_confirm_new_password( d, argument );
         break;

      case CON_GET_NEW_SEX:
         nanny_get_new_sex( d, argument );
         break;

      case CON_GET_NEW_CLASS:
         nanny_get_new_class( d, argument );
         break;

	case CON_GET_NEW_PET:
	nanny_get_new_pet( d, argument );
	break;

      case CON_GET_NEW_RACE:
         nanny_get_new_race( d, argument );
         break;

      case CON_GET_WANT_RIPANSI:
         nanny_get_want_ripansi( d, argument );
         break;

      case CON_PRESS_ENTER:
         nanny_press_enter( d, argument );
         break;

      case CON_READ_MOTD:
         nanny_read_motd( d, argument );
         break;

		case CON_TERMS_CONDITIONS:
		nanny_terms_conditions( d, argument );
		break;
		
		case CON_GET_EYE_COLOUR:
		nanny_get_eye_colour( d, argument );
		break;
		
		case CON_GET_HAIR_COLOUR:
		nanny_get_hair_colour( d, argument );
		break;
		
		case CON_GET_PATRONUS:
		nanny_get_patronus( d, argument );
		break;
		
		case CON_GET_HOUSE_Q1:
		nanny_get_house_q1( d, argument );
		break;
		
		case CON_GET_HOUSE_Q2:
		nanny_get_house_q2( d, argument );
		break;
		
		case CON_GET_HOUSE_Q3:
		nanny_get_house_q3( d, argument );
		break;
		
		case CON_GET_HOUSE_Q4:
		nanny_get_house_q4( d, argument );
		break;
		
		case CON_GET_HOUSE_Q5:
		nanny_get_house_q5( d, argument );
		break;

   }

   return;
}

Post is unread #5 Jun 29, 2009 2:18 pm   
Go to the top of the page
Go to the bottom of the page

Tonitrus
Fledgling
GroupMembers
Posts47
JoinedJun 24, 2009

 
I don't see anything in the code that would cause it to do that.

Note: I'm not terribly perceptive as a rule.

I occasionally get weird problems like this where new changes I make are ignored, and I just make clean, recompile. Usually fixes them. I have no idea what causes them to begin with. If that doesn't work, you might have to step it through gdb. I don't know what else to tell you off-hand.

Post is unread #6 Jun 29, 2009 2:37 pm   
Go to the top of the page
Go to the bottom of the page

InfiniteAxis
Off the Edge of the Map
GroupAdministrators
Posts1,200
JoinedMar 21, 2006

 
Not seeing anything in the code either.

Try a make clean, make, and then hotboot/reboot the mud and see if that changes anything. Short of that, I'm not really sure what could cause this kind of issue.

Post is unread #7 Jun 30, 2009 10:17 am   
Go to the top of the page
Go to the bottom of the page

paradox24
Fledgling
GroupMembers
Posts18
JoinedMar 6, 2009

 
so, much to my dismay, I've made a big fuss over nothing lol ...

somehow, even tho i manually editted it and checked it twice .. the startup file decided to stay the same (which had been modified to point to a real directory not a relative path due to my hosting not liking the ../area stuff) ... and so it was spawning a much older version ..

good part, is that I cleaned up that part of the code so well you could eat off it now :P

thanks for the comments guys, I'll try to not be so quick to ask for help next time .. it was just driving me nuts for a few hours and I figured I must've missed something about nanny()

Post is unread #8 Jun 30, 2009 3:05 pm   
Go to the top of the page
Go to the bottom of the page

Tonitrus
Fledgling
GroupMembers
Posts47
JoinedJun 24, 2009

 
One thing I do to make sure I'm actually running the code I'm currently writing is spam it as full of debug messages (usually using bug() because I'm lazy) as I can and watching the bug channel. If I don't see 30 messages when something happens, I can tell something's wrong.

Like

void blah( int x ) {
bug( "debug: blah() {" );
bug( "debug: if( x )" );
if( x ) {
bug( "debug: do_crap( x );"
do_crap( x );
}
bug( "return;" );
return;
}

It's really spammy, but it makes it pretty apparent when I've forgotten to reboot the server, forgotten to compile the code,
or, in some cases, forgotten I'm in the wrong damn directory. The latter being one of the downsides of using other code
trees as reference.

Pages:<< prev 1 next >>