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 ➜ smaug vs smaugfuss , snippets and my mental defects

smaug vs smaugfuss , snippets and my mental defects

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


Posted by Soul Demon   (6 posts)  Bio
Date Fri 30 Jan 2004 04:49 PM (UTC)
Message
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.

Top

Posted by Samson   USA  (683 posts)  Bio
Date Reply #1 on Fri 30 Jan 2004 06:26 PM (UTC)
Message
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.
Top

Posted by Ithildin   USA  (262 posts)  Bio
Date Reply #2 on Fri 05 Mar 2004 04:53 AM (UTC)
Message
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.

Top

Posted by Ithildin   USA  (262 posts)  Bio
Date Reply #3 on Fri 05 Mar 2004 04:55 AM (UTC)
Message
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?
Top

Posted by Ithildin   USA  (262 posts)  Bio
Date Reply #4 on Fri 05 Mar 2004 05:22 AM (UTC)
Message
hmm...wierd. it jsut started working all of the sudden? i didn't change any of the code at all..that's wierd
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #5 on Fri 05 Mar 2004 05:51 AM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


21,330 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.