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 ➜ Bank commands...

Bank commands...

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


Pages: 1 2  

Posted by Bryn   (14 posts)  Bio
Date Sun 05 Jan 2003 08:08 AM (UTC)
Message
I was adding a bank snippet today, and i got to the part where i add balance, withdraw and deposit to tables.c, but all the readme said was "Make the appropriate additions to tables.c for do_balance, do_withdraw, and do_deposit." Can anyone please tell me just what to add to tables.c?


Bryn
Top

Posted by Typhon   USA  (112 posts)  Bio
Date Reply #1 on Sun 05 Jan 2003 12:27 PM (UTC)
Message
all you have to do is find...
if ( !str_cmp( name, "do_*" )) return do_*;

where * is the name off ythe function you want to add... that section its important to put the if statement alphabetically according to the name of the command... search for case 'w': and put the if statement for withdraw in there and then search for case 'b': and add balance and search for case 'd' and add deposit...
then search for
char *skill_name( DO_FUN *skill )
and add
if ( skill == do_* ) return "do_*";
for each of the three commands anywhere after the

if ( skill == NULL ) return "reserved";

you should be all set :)
-typhon
Top

Posted by Bryn   (14 posts)  Bio
Date Reply #2 on Mon 06 Jan 2003 01:47 AM (UTC)
Message
i added those into tables.c, and the file compiled just fine, but after it created the .o files it gave me two errors for each command that said(this is only one example)
"tables.o(.text+0x61bf):/home/Bryn/smaug/dist/src/tables.c:853 undefined refrence to '_do_balance'

what did i do wrong?
Top

Posted by Meerclar   USA  (733 posts)  Bio
Date Reply #3 on Mon 06 Jan 2003 03:36 AM (UTC)
Message
"do_balance" rather than "_do_balance"

Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #4 on Tue 07 Jan 2003 09:09 PM (UTC)
Message
I think the compiler adds the underscore.

Check the new file (with do_balance in it) is linked into the executable. eg. look in the makefile to make sure that the file name (eg. banking.o) is in the list of object files.

- Nick Gammon

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

Posted by Ithildin   USA  (262 posts)  Bio
Date Reply #5 on Sun 29 Feb 2004 01:12 AM (UTC)
Message
To bring an old subject up...

i tried installing Samsons' bank code from his site. everything compiled fine, but when i go to put the commands in the game, it won't let me.

Log: Ithildin: cedit balance create do_balance
Command added.
Code do_balance not found. Set to no code.

what can i do?
Top

Posted by Typhon   USA  (112 posts)  Bio
Date Reply #6 on Sun 29 Feb 2004 09:57 AM (UTC)
Message
did you add the commands to tables.c and the DECLARE_DO_FUN to mud.h?
Top

Posted by Ithildin   USA  (262 posts)  Bio
Date Reply #7 on Sun 29 Feb 2004 02:05 PM (UTC)
Message
yep. i added everything. i even looked up another command to make sure i had it in all the places that it needed to be. i know i'm just doing one simple thing wrong, but i can't find it anywhere. i tried puttin in rafermands bank snippet, but i had the same problem so i just figured it didn't work, so i switched to this one and now i can't do it either. the code is in bank.c, for some reason it might not be reading bank.c correctly. it's in my project, i'm using windows right now. i even put it in the makefile. it compiles it when it recompiles. this is buggin me. heh. i know it's something stupid.
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #8 on Mon 01 Mar 2004 12:31 AM (UTC)
Message
Make sure the "do_balance" command is in the "b" part of tables.c. Just with other commands is not enough, it has to be in the "b" section.

- Nick Gammon

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

Posted by Ithildin   USA  (262 posts)  Bio
Date Reply #9 on Mon 01 Mar 2004 03:54 AM (UTC)
Message
i did that at the beginning. i'm still not sure what's going on.
Top

Posted by Ithildin   USA  (262 posts)  Bio
Date Reply #10 on Mon 01 Mar 2004 04:38 PM (UTC)
Message
here's what i have so far. but it just won't let me cedit it in the mud. can't find do_balance or any of the others.


case 'b':
	if ( !str_cmp( name, "do_backstab" ))		return do_backstab;
	if ( !str_cmp( name, "do_balzhur" ))		return do_balzhur;
	if ( !str_cmp( name, "do_balance" ))		return do_balance;

and here:

if ( skill == do_backstab )		return "do_backstab";
	if ( skill == do_balance )		return "do_balance";
    if ( skill == do_balzhur )		return "do_balzhur";


that's where my do balance is. it's also the same with withdraw and deposit. they are in alphabetical order. my declares are in there as well.

would it have to do with the fact that bank.c and bank.h aren't compiling correctly even though it shows them compiling?
Top

Posted by Greven   Canada  (835 posts)  Bio
Date Reply #11 on Mon 01 Mar 2004 06:44 PM (UTC)
Message
Its possible, like if you've got multiple declaration calls and such, but it would be more important if your getting errors from table.c about it. What are th errors? If we can see them, we might be able to show you how to correct them.

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #12 on Mon 01 Mar 2004 07:58 PM (UTC)
Message
Well, the only place that message appears is in act_wiz.c, here:


        command->do_fun = skill_function( arg2 );
        add_command( command );
        send_to_char( "Command added.\n\r", ch );
        if ( command->do_fun == skill_notfound )
            ch_printf( ch, "Code %s not found.  Set to no code.\n\r", arg2 );


If you get no compiler errors or warnings, and you cannot see what is the problem, put a breakpoint on the first line, above, step into skill_function, and see what happens when it tries to find your function name.

- Nick Gammon

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

Posted by Ithildin   USA  (262 posts)  Bio
Date Reply #13 on Tue 02 Mar 2004 04:19 AM (UTC)

Amended on Tue 02 Mar 2004 04:58 AM (UTC) by Ithildin

Message
hey nick, i'm not really understanding what your trying to say. this may sound stupid, but what do you mean by breakpoint? Greven, i'm not getting any errors. i'm not really sure what's going on. i'm going to have a hard look into it here in a second. i haven't had much time to look at it much.

THanks for all the help

here's the help file i used.

Quote:

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.
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #14 on Tue 02 Mar 2004 05:04 AM (UTC)
Message
See this post:

http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=3653

If you have followed the instructions, and done a make, and are using the new version, then you probably need to use gdb to find exactly what is wrong.

- 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.


59,606 views.

This is page 1, subject is 2 pages long: 1 2  [Next page]

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.