Adding Commands.

Posted by AkiraMuyo on Thu 17 Oct 2002 08:59 PM — 5 posts, 22,281 views.

#0
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
Australia Forum Administrator #1
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.
#2
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
United Kingdom #3
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?
Australia Forum Administrator #4
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?