Verb declarations are a simple way of attaching player commands to
objects. Verb declarations must appear in the declarations section
of an object, before any method declarations.  A verb declaration
is like a template, which reads from left to right.  On the left is
the pattern to be matched, on the right is the method called if there
is a match.  For example,

    verb "look" = look;

This defines a mapping between the command "look" and the "look"
method on the object.  When the object is checked for commands, the
command "look" will cause the method named "look" on the object to
be called.  Any arguments may follow the verb in this example, so
the commands "look fred", "look", and "look at the pretty flowers"
would all match.  If further parsing is required, prepositions may
be used (see below). If only a verb is specified, only the first word of
the command will be checked; checking the arguments must be
performed by the associated method.

Verb Aliases

Multiple verbs may be listed in the same declaration, separated by

    verb "look examine" = look;

These act as aliases, so either "look" or "examine" will call the
'look' method.


The asterisk character, *, may be used to indicate abbreviations:

    verb "l*ook" = look;

This will match the commands "l", "lo", "loo", and "look".

The characters up to the asterisk _must_ be typed in order for
the command to match.  Characters after the asterisk are
optional.  For example,

    verb "exa*mine" = examine;

would match "exa", "exam", etc., but not "ex" or "e".


In addition the the verb name, a preposition may be supplied:

    verb "hit" : "with" = hit;

Here, the colon separates the verb and preposition.  Only commands
containing both the verb and that preposition in them will be
matched:  "hit joe with sledghammer" and "hit with book" would
match; "hit" by itself would not.  Multiple prepositions may
also be used:

    verb "hit smack" : "with using" = hit;

Commands matching this template include:  "hit using sword"  "smack
troll with emacs source", "smack with fred", etc.  No abbreviations
may be used for prepositions.

Any word or character may be used as a preposition, so emulating
TinyMUD is possible:

    verb "@desc*ribe" : "=" = describe;

This hard-to-read declaration uses "=" as the preposition, so the

    @desc me = groovy

would match.  Note that spaces around the "=" are required,

Inheritance of Verbs

All verbs declared by an object are inherited by instances of that
object.  For example:

    object FOO
	verb "hit" = hit;

	method hit

    object BAR
	parents FOO;
Now both FOO and BAR have 'hit' verb available.  

It is important to note that verb and method inheritance are separate,
and both start from the instances and move up.  When a verb matches,
the method is passed to the child, even if the verb was declared
on the parent.  If the child object redefines the method, that
method will be used instead.  In the example above, if BAR defined a
'hit' method, it would be used when BAR was 'hit'.  Redeclaring the
verb isn't necessary.

The Method Part

We've seen how a verb template is set up, but so far no action
can be taken because we don't have a method to be called.  When
writing a method to be used as a verb, certain conditions apply.

Verb Arguments

When a method is called as a verb, the arguments to the verb
are passed as strings in the "args" variable, as follows:

	without prep	with prep
	------------	---------
args[1]	verb		verb
args[2] direct object	direct object
args[3] 		prep
args[4]			indirect object

The parser itself does no matching of dobj or iobj.  The method
itself is responsible for ensuring that the arguments specified
refer to the correct object.  For example, consider a "button"
object with the verb declaration:

	verb "press" = press;

This declaration matches "press button", but also "press", "press nancy",
etc.  In order to make sure the command refers to the button, we must
explicitly match args[2], the direct object:

	method press /* verb */
	    if (!this.match(args[2]))	/* not this object */
		return 1;		/* abort */

Here we are assuming that the object has a method called "match",
which returns 1 if the argument matches the object's name.  If
the direct object doesn't match the object's name, the verb
is exited with numeric value '1'.  The return value from a
verb method has a special meaning.  Returning a non-zero value
indicates to the parser that no match was found, and the parser
should continue to look for verbs on this and other objects.  Returning
zero means that the match was successful, and no further parsing should
be done.

NOTE:  It is a good idea to comment the 'method' declaration of a
       method which is being used as a verb, to remind yourself of the
       special conditions which apply to writing a verb (arguments,
       return value).