[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  Compiling the server
. . -> [Subject]  bank code compile errors
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

bank code compile errors

It is now over 60 days since the last post. This thread is closed.   [New subject]  Start a new subject   [Refresh] Refresh page


Posted by Duracel   (6 posts)  [Biography] bio
Date Sat 08 May 2004 03:35 PM (UTC)  quote  ]
Message
Hi, I'm still fairly new to coding, I'm having problems installing a smaug banking code written by Minas Ravenblood, on the latest version of smaugfuss..

Help would be highly appreciated..

Cygwin errors at are:

bank.c: In function `do_deposit':
bank.c:126: error: structure has no member named `balance'
bank.c:129: warning: too many arguments for format
bank.c: In function `do_withdraw':
bank.c:177: error: structure has no member named `balance'
bank.c:181: error: structure has no member named `balance'
bank.c:195: error: structure has no member named `balance'
bank.c: In function `do_balance':
bank.c:223: error: structure has no member named `balance'


I've been looking at the given lines for some time now but cant seem to figure out what I did wrong..

I'm hoping anyone can help me out here before I turn grey and pull out all my hair :/

Thanks in advance

-Addrodoc-
[Go to top] top

Posted by Duracel   (6 posts)  [Biography] bio
Date Reply #1 on Sat 08 May 2004 03:45 PM (UTC)  quote  ]
Message
A message directed to Mr Gammon: I've lost my old password and screwed up a few times at both requesting my old password and making a new account..

I'm not sure if one is allowed to have a second account, if it's a problem then please delete my old account and i'll stick to this one in the future.

thanks
[Go to top] top

Posted by Meerclar   USA  (600 posts)  [Biography] bio
Date Reply #2 on Sat 08 May 2004 09:24 PM (UTC)  quote  ]
Message
Post us the offending code and we can help more, just giving error messages leads to little more than guesswork I'm afraid.

Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org
[Go to top] top

Posted by Duracel   (6 posts)  [Biography] bio
Date Reply #3 on Sat 08 May 2004 09:54 PM (UTC)  quote  ]
Message
bank.c:126: error: structure has no member named `balance'

ch->gold -= amount;
ch->pcdata->balance += amount; <-- line 126
set_char_color( AT_PLAIN, ch );
ch_printf( ch, "You deposit %d gold.\n\r", amount );
snprintf( buf, MAX_STRING_LENGTH, "$n deposits %d gold.\n\r", amount );
act( AT_PLAIN, buf, ch, NULL, NULL, TO_ROOM );
save_char_obj( ch );
return;
}

bank.c:177: error: structure has no member named `balance'
bank.c:181: error: structure has no member named `balance'

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

if( amount > ch->pcdata->balance ) <--- line 181
{


a few more all pointing out to pcdata->balance..
------------------------------------------------------------
I followed these instructions:
1. To install this code:

Copy bank.c and bank.h to your src directory. Add bank.c, bank.h
and bank.o to the appropriate sections in your Makefile.

2. In mud.h, find the pc_data structure, and add the following to it:

int balance;

Find the following:

#define LEVEL_HIGOD LEVEL_GOD

and after it add: #include "bank.h"

find the ACT flags for mobiles, and define
ACT_BANKER using an available slot.

3. In save.c, function fwrite_char, find the following line:

fprintf( fp, "Favor %d\n", ch->pcdata->favor );

Add the following line below it:

fprintf( fp, "Balance %d\n", ch->pcdata->balance );

Locate function load_char_obj, find the following line:

ch->pcdata->wizinvis = 0;

Add the following line below it:

ch->pcdata->balance = 0;

Locate function fread_char, find the following line:
KEY( "Bamfin", ch->pcdata->bamfin, fread_string_nohash( fp ) );

Add the following line above it:

KEY( "Balance", ch->pcdata->balance, fread_number( fp ) );

4. In build.c, find the act_flags for mobs, and add "banker" in the
spot corresponding to the new ACT_BANKER flag you defined in mud.h.

5. Make the appropriate additions to tables.c for
do_balance, do_withdraw, and do_deposit.

6. Add the text from bank.help to your help.are file.

7. Make clean, then recompile.

8. Create commands for balance, deposit, and withdraw.

9. Set the banker flag on a mob of your choice.
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio   Moderator
Date Reply #4 on Sun 09 May 2004 12:20 AM (UTC)  quote  ]
Message
Looks like you didn't add the balance field to the pc_data structure. You should do that, and then 'make clean' then 'make'.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

Posted by Duracel   (6 posts)  [Biography] bio
Date Reply #5 on Sun 09 May 2004 09:08 AM (UTC)  quote  ]
Message
I've added the line 'int balance;' to the part 'struct char_data' in mud.h (it's the only part I can find that looks like pc data structure.. Also, running a find on pc_data structure doesnt seem to work)

It seems I'm having a hard time locating the pc data structure in mud.h.. can someone point out where and what to look for?

thanks
[Go to top] top

Posted by Nick Cash   USA  (626 posts)  [Biography] bio
Date Reply #6 on Sun 09 May 2004 06:46 PM (UTC)  quote  ]
Message
Search for this comment: Data which only PC's have.

~Nick Cash
http://www.nick-cash.com
[Go to top] top

Posted by Samson   USA  (683 posts)  [Biography] bio
Date Reply #7 on Sun 09 May 2004 07:46 PM (UTC)  quote  ]
Message
Hunting for pc_data would have led you there as well, probably just needed to bounce down a bit farther is all :)

SmaugMuds.org: http://www.smaugmuds.org - The Smaug MUDs Community Center

"The past was erased, the erasure was forgotten, the lie became truth." -- George Orwell, 1984
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio   Moderator
Date Reply #8 on Sun 09 May 2004 08:24 PM (UTC)  quote  ]
Message
Yes, if the instructions say add it to pc_data and you add it to char_data, the snippet certainly won't work. :-)

The exact phrase you want to search for is "pc_data" as Samson said. Perhaps "struct pc_data" will work as well. Or use the comment that Whiteknight suggested.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

Posted by Duracel   (6 posts)  [Biography] bio
Date Reply #9 on Sun 09 May 2004 09:30 PM (UTC)  quote  ]
Message
I got it to compile without errors, thanks everyone.

However, when I log on the mud and give a mob a banker flag, it doesn't recognise my mob as a banker.

I've tried to give the act flag a different place and number, but after a compile it is still giving me the message 'You're not in a bank!'.

I'm not ready to give up yet, and knowing myself I probably wont stop untill I go K.O from a lack of sleep.. so help is appreciated :)
[Go to top] top

Posted by Meerclar   USA  (600 posts)  [Biography] bio
Date Reply #10 on Sun 09 May 2004 09:38 PM (UTC)  quote  ]
Message
if you are giving the flag to a mob thats already loaded youll need to destroy the existing mobs and load new ones before the flag goes into effect usually. You probly could use set to add the flag to the existing mobs but it tends to be more headache than its worth to try.

Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org
[Go to top] top

Posted by Duracel   (6 posts)  [Biography] bio
Date Reply #11 on Wed 12 May 2004 10:58 PM (UTC)  quote  ]
Message
I got it to work, thanks everyone. I would not have been able to do this without the help of you guys. I've learned a lot over the last few days and am encouraged to keep building. Thanks! I'm hoping one day I will be able to give some knowledge back to the community... Untill then, I'll be around here reading and perhaps posting questions once new bugs and errors pop up. :P

Once again, THANKS x100!
[Go to top] 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.


3,068 views.

It is now over 60 days since the last post. This thread is closed.   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Web site powered by FutureQuest.Net]