Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
Development
Nov 28, 2018, 10:10 am
By Keirath
First Immortal
Oct 12, 2018, 12:02 pm
By GatewaySysop
Bug in do_climb( )
Jun 5, 2018, 5:31 pm
By joeyfogas
question on overland code
May 31, 2018, 10:03 am
By joeyfogas
KaVir's Protocol Snip
May 15, 2018, 7:57 pm
By joeyfogas
tintin++ ogg sound player script for linux
Author: Robert Smith
Submitted by: Vladaar
6Dragons ogg Soundpack
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.4
Author: Vladaar
Submitted by: Vladaar
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
Users Online
CommonCrawl, DotBot

Members: 0
Guests: 20
Stats
Files
Topics
Posts
Members
Newest Member
481
3,740
19,397
632
ClarenceKe
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » AFKMud Support & Development » How do I add new commands?
Forum Rules | Mark all | Recent Posts

How do I add new commands?
< Newer Topic :: Older Topic > Mini-guide

Pages:<< prev 1 next >>
Post is unread #1 Jan 6, 2004, 6:11 am
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,644
JoinedJan 1, 2002

Since this gets asked alot, I figured I'd improvise a short hack guide to this.

Most Smaug bases require 4 things to add a new command:

1. The do_fun code for the command itself
2. A DECLARE_DO_FUN line in mud.h.
3. 2 entries in tables.c.
4. Use of the cedit command to activate it.

AFKMud does not require steps 2 and 3, but there is a difference in how step 1 needs to be done. For a command to work, it must be defined as a CMDF instead of a void.

Example:

void do_something( CHAR_DATA *ch, char *argument )

The above is what would work for Smaug. For AFKMud, use the following instead:

CMDF do_something( CHAR_DATA *ch, char *argument )

The main difference being the use of the CMDF macro. This was necessary in order to get g++ to accept the use of the dlsym code while also retaining compatibility with plain gcc for those who prefer that. The details aren't terribly important to know.

Step 4 of the process is the same:

cedit something create

or

cedit something create do_something

If you get an error that do_something is not found, then the source code is either missing or the code is using void instead of CMDF.

Any snippets which still use the void declarartion for do_something will need to be changed to CMDF format to make them work as well.
       
Pages:<< prev 1 next >>