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 ➜ Adding Commands.

Adding Commands.

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


Posted by AkiraMuyo   (41 posts)  Bio
Date Thu 17 Oct 2002 08:59 PM (UTC)
Message
I've followed the instructions completly, However my new commands are still not showing up. Heres basically what I did.

I went into act_info.c copied do_where, and below it pasted it. Then I changed the functions name do_where, to do_newwho.

Next I went into tables.c and added both a
if ( skill == do_newwho ) return "do_newwho";
and
if ( !str_cmp( name, "do_newwho")) return do_newwho;
Both in there appropriate fields under do_where.

Next I went into mud.h and added a declare_do_fun like so,
DECLARE_DO_FUN( do_newwho );
I added this right below do_where like the others.

I then build the source code, and with no errors I then run it. When i'm in the game I type the following,
cedit newwho create do_newwho

Which gives me the error,
Command added.
Code do_newwho not found. Set to no code.

Now that I got that error, I mine as well trying to add it literally in commands.dat in the system folder. So I go in, copy do_where, paste it under itself and re-name it to do the newwho, and command do_newwho.
I reboot the mud, and try "newwho" in game, which gives me a lovely huh?

Well, I must be doing something wrong.. But I'm unsure what, can you please help me?!

Thanks,
Akira
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #1 on Thu 17 Oct 2002 09:40 PM (UTC)
Message
I started to reproduce what you did and think I found the problem. It all sounds perfect except for one thing. When you did the test for "do_newwho" it sounds like you did this:


    case 'w':
    if ( !str_cmp( name, "do_wake" ))       return do_wake;
    if ( !str_cmp( name, "do_wartalk" ))        return do_wartalk;
        if ( !str_cmp( name, "do_warn" ))       return do_warn;
    if ( !str_cmp( name, "do_watch" ))      return do_watch;
    if ( !str_cmp( name, "do_wear" ))       return do_wear;
    if ( !str_cmp( name, "do_weather" ))        return do_weather;
    if ( !str_cmp( name, "do_west" ))       return do_west;
    if ( !str_cmp( name, "do_where" ))      return do_where;
    if ( !str_cmp( name, "do_newwho" ))      return do_newwho;
    if ( !str_cmp( name, "do_whisper"))     return do_whisper;
    if ( !str_cmp( name, "do_who" ))        return do_who;
    if ( !str_cmp( name, "do_whois" ))      return do_whois;
    if ( !str_cmp( name, "do_wimpy" ))      return do_wimpy;
    if ( !str_cmp( name, "do_wizhelp" ))        return do_wizhelp;


This is because you said you did it "under do_where".

However if you look back a bit you can see that that batch of tests is under a case test for "w". Since "newwho" starts with "n" and not "w" you need to put it in the "n" section. That would cause the problems you describe.

- Nick Gammon

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

Posted by AkiraMuyo   (41 posts)  Bio
Date Reply #2 on Thu 17 Oct 2002 10:43 PM (UTC)
Message
Its official, i'm a moron. heh. Thanks a ton nick! Now i'll just go off and huddle in a corner muttering "but but but".


hehe, thanks agian,
Akira
Top

Posted by Rash   United Kingdom  (56 posts)  Bio
Date Reply #3 on Wed 30 Jul 2003 02:51 AM (UTC)
Message
Im having a problem thats nearly the same...

After installing the code i needed into act_inf.c, declareing it in mud.h and adding the entries for tables.c and adding the defines in mud.h, i make clean then make wthout error. after which i log on to the mud and start to create the commands...only when i type cedit mana create do_mana it comes back with no code. iv checked tables.c and every thing is where it should be and the defines and edclares and code is correct too i just odnt know whats wrong...i tried to add them in the commands.dat file and that dint work either...any ideas?
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #4 on Thu 31 Jul 2003 01:31 AM (UTC)
Message
Can you copy (from the source) and paste (here) around 20 lines of code centered on the part in tables.c where you added the new command?

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


16,937 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.