smaug vs smaugfuss , snippets and my mental defects

Posted by Soul Demon on Fri 30 Jan 2004 04:49 PM — 6 posts, 23,667 views.

#0
Ok to start with i am not experienced at all when it comes to coding, that being said, i have successfully added some snippets to the smaug 1.4a available from this site.... to be exact the banking code created by minas ravenblood and modified by samson and the stat roller made by unknown and ported to smaug by samson.
i have recently discovered smaugFuss and am currently attempting to add these same snippets.
my problem is that i have gotten the stat roller to work but cannot get the bank snippet to work, although it compiles with no error. i can set a mob with the banker flag but when i deposit... it checks balance and when i balance and withdraw it says ...huh!
i have quintiple checked what i have done and am sure that i have followed the directions correctly.
anyway guess i should actually ask my question..
are the differences between smaug 1.4a and smaugFuss significant enough that i would be a fool to not use smaugFuss.. could these differences between the two be my source of trouble or should i chalk this up to my own personal mental handicaps.
i would like to use smaugfuss due to the bugfixes but the ability to add the snippets that i desire is also very important to me.. am i going to find that snippets that are easily added to smaug 1.4a are not so easily added to smaugfuss. in the end i intend to learn coding and be eventually able to decipher these problems on my own but for now i feel i need a bit of advice...

many thanks in advance to whomever is willing to help me.

USA #1
There is no real difference between FUSS and normal except for the bugfixes that FUSS contains that were presented over the years. There should be no problem with adding snippets meant for Smaug. It's the same code, just fixed up.

It sounds to me like you may have forgotten to add the balance command to the mud after getting the code put in.
USA #2
i added the bank code to my smaugfuss, and every time i try to withdraw my mud crashes. i can deposit and balance ok. i looked through the withdraw code, but i'm not sure what's wrong.

upon further testing, i can't go over 3 places. i can withdraw 2 gold, 20 gold, 200 gold, but if i go for 2000 gold it crashes.


void do_withdraw( CHAR_DATA *ch, char *argument )
{
   CHAR_DATA *banker;
   char arg1[MAX_INPUT_LENGTH];
   char buf [MAX_STRING_LENGTH];
   int amount;

   if ( !( banker = find_banker( ch ) ) )
   {
      send_to_char( "You're not in a bank!\n\r", ch );
      return;
   }

   if ( IS_NPC( ch ) )
   {
      sprintf( buf, "Sorry, %s, we don't do business with mobs.", ch->short_descr );
      do_say( banker, buf );
      return;
   }

   if ( argument[0] == '\0' )
   {
      do_say( banker, "If you need help, see HELP BANK." );
      return;
   }

   argument = one_argument( argument, arg1 );

   if ( arg1 == '\0' )
   {
      sprintf( buf, "%s How much gold do you wish to withdraw?", ch->name );
      do_tell( banker, buf );
      return;
   }
   if ( str_cmp( arg1, "all" ) && !is_number( arg1 ) )
   { 
      sprintf( buf, "%s How much gold do you wish to withdraw?", ch->name );
      do_tell( banker, buf );
      return;
   }

   if ( !str_cmp( arg1, "all" ) )
	amount = ch->pcdata->balance;
   else
      amount = atoi( arg1 );

   if( amount > ch->pcdata->balance )
   {
      sprintf( buf, "%s But you do not have that much gold in your account!", ch->name );
      do_tell( banker, buf );
      return;
   }

   if ( amount <= 0 )
   {
      sprintf( buf, "%s Oh I see.. your a comedian.", ch->name );
      do_tell( banker, buf );
      return;
   }

   ch->pcdata->balance -= amount;
   ch->gold += amount;
   set_char_color( AT_PLAIN, ch );
   ch_printf( ch, "You withdraw %d gold.\n\r", amount );
   sprintf( buf, "$n withdraws %d gold.\n\r", amount );
   act( AT_PLAIN, buf, ch, NULL, NULL, TO_ROOM );
   save_char_obj( ch );
   return;
}


i'm guessin it's in the arg1 or something.

USA #3
i think it might have to do with max_input_length in mud.h, there it says that the max is 1024. is this what's wrong? would it be ok if i changed it?
USA #4
hmm...wierd. it jsut started working all of the sudden? i didn't change any of the code at all..that's wierd
Australia Forum Administrator #5
I wouldn't change MAX_INPUT_LENGTH. That refers to how long a command can be. For instance, typing "withdraw 2000" is only 13 characters long.

Sounds like you may not have recompiled everything, make sure you delete all object files (rm *.o) when you add major changes.

If it happens again read my write-up on using gdb, run under gdb and then type "bt" to find the exact line that it crashed on.