Defines for a Command

The command define is both simple and flexible but it is hard to explain without an example. Example 2-2 shows what a commands define looks like using who as the command and the following list explains what each field is.

Example 2-2. Who Define

command  = who
func          = who_dil@commands
minpos   = POSITION_DEAD
minlevel = 0
loglevel = 0
type     = 0

command

The element of the define file that is the command name to be typed. When creating your command names you must follow the variable naming rules as defined in the dil manual.

func

The element that defines what function is to be run when the command is executed. This element is used when defining a dil command rather than when using an internal function.

internal

The element that defines which internal function is to be used for the command being defined. For a complete listing of the functions that you can use, consult Appendix A.

minpos

The element that defines what the Minimum position a character must be in order to be able to execute the command.

minlevel

The element that defines what the Minimum level a character must be in order to use the command that is being defined.

loglevel

The level an character must be in order to see the logs. When you set this value to zero it turns off logging of the command, most commands are set to zero so that the log files don't get to big. Setting the log level lower than 200 is no different from setting it to 200, because players that are not in the Admin level range (200-255) will not be able to see the logs.

type

the element that defines the type of command, social, skill, or other that this define is referencing.

The only two parts of the command define that may be confusing are the 'func/internal' and the 'type' fields. The 'func/internal' field is confusing to many because it can be both a symbolic DIL name or an internal function while the 'type' field can be anything you like. We will try to clear these both up now.

The 'func/internal' field accepts both a dil symbolic name or an internal function name because some commands are not converted to dil but we want to allow you to change their names or change the order they show up in the define file. You may wonder why it would matter what order you put the commands in the define file. IN order to explain that you will need to imagine what would happen if you put the command 'nod' in front of the command 'north' in the command define file. The VME would load the command 'nod' first and then command 'north' thus when you used short hand and typed only 'n' you would get the 'nod' command. This of corse is not what you want so you will want to put higher priority commands first in the define file. In this case you would want to have 'north' before 'nod'.

Lets say you want to do something like make the 'north' command, which is still an internal function as of the writing of this manual, activate when you type the word 'forward'. All you would have to do is duplicate the define for 'north' and change the command name to forward. You now have a simple copy of the north command all together if you remove the define for it.

The 'type' field is just what it says it is. It is a way you can define the type of command or skill you are creating. We use it to split up which commands are socials, skills, wiz commands, and regular commands. For example a social may look something like Example 2-3.

Example 2-3. Social Define

command = bow
func = bow@socials
minpos = POSITION_STANDING
minlevel = 0
type = TYPE_SOCIAL

Then in our values.h we create a define that gives a value to the type social.

#define TYPE_SOCIAL  45
Any value will do just so its a unique value that you c an use later to understand what command or skill is what type. If your still confused about how the type field works don't worry this will become much more clear in the sections on creating a command or skill.