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 ➜ Can't save new commands?

Can't save new commands?

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


Posted by Ingus   (4 posts)  Bio
Date Fri 28 Mar 2003 11:29 PM (UTC)
Message
I add new commands to the source, declaring them in mud.h, and the usual if checks in tables.c. I create them using cedit <command> <code> and it finds the code and the command works like it should. But when I save the command table (or even before I save it) and look at the command again for its code it has something like this: (00401EA1)
On the next reboot the command doesnt work (Huh?) and I have to cedit again. I tried manually putting it in commands.dat with a text editor but still I come up with the same result. Anyone have any ideas?
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Sat 29 Mar 2003 12:06 AM (UTC)
Message
A common mistake is to take the lines in tables.c, and copy one, like this:


    case 'c':
        if ( !str_cmp( name, "do_cast" ))               return do_cast;         
        if ( !str_cmp( name, "do_cedit" ))              return do_cedit;
        if ( !str_cmp( name, "do_channels" ))           return do_channels;     
        if ( !str_cmp( name, "do_chat" ))               return do_chat;      


Say you decide to copy the "do_cast" line, but your new command is "do_marry", you get this:


    case 'c':
        if ( !str_cmp( name, "do_cast" ))               return do_cast;         
        if ( !str_cmp( name, "do_marry" ))               return do_marry;         
        if ( !str_cmp( name, "do_cedit" ))              return do_cedit;
        if ( !str_cmp( name, "do_channels" ))           return do_channels;     
        if ( !str_cmp( name, "do_chat" ))               return do_chat;      


However the problem is the command is in the "c" section, whereas "marry" should be in the "m" section.

- Nick Gammon

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

Posted by Ingus   (4 posts)  Bio
Date Reply #2 on Sat 29 Mar 2003 12:56 AM (UTC)
Message
No luck, the two commands I added are both in there respective cases. I have found that I can manually edit the commands.dat file and restart the mud and everything seems ok. As soon as I do a 'cedit save cmdtable' and reboot, however, the commands are gone again, the code field being replaced with that (43cdg435) junk.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #3 on Sun 30 Mar 2003 12:08 AM (UTC)
Message
In tables.c there is some code:



char *skill_name( DO_FUN *skill )
{
    static char buf[64];

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

...

    if ( skill == do_ilist )            return "do_ilist";    
    if ( skill == do_rping )            return "do_rping";  
#endif

    sprintf( buf, "(%p)", skill );
    return buf;
}


Notice how it returns the address of the skill if it isn't in the list (line in bold)? That suggests to me that your new command isn't in the list above.


- Nick Gammon

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

Posted by Ingus   (4 posts)  Bio
Date Reply #4 on Sun 30 Mar 2003 02:07 AM (UTC)
Message
DOH! Indeed, that seems to be it. Don't I feel silly. At least it's simple ;) Thanks Nick, you're the man!
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.


17,494 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.