Go to the first, previous, next, last section, table of contents.


Dealing with Verbs and Properties

Verbs and properties are the elements of objects that make them useful. A verb allows you to define things to do with an object, and properties are used to store state information about the object. A verb can be thought of as a MOO code program, executed when the verb on the object is invoked. This can happen if the LambdaMOO parser matches the user input with the verb on an object, or when another MOO code program explicitly calls the verb. Several commands are available to allow manipulation of properties and verbs.

Command: @show object
Command: @show object.prop-name
Command: @show object:verb-name
Displays quite detailed information about an object, property or verb, including its name, owner, permission bits, etc. The information displayed for an object can be quite long, but usually fits on most screens.
Command: @chmod object object-permissions
Command: @chmod object.prop-name property-permissions
Command: @chmod object:verb-name verb-permissions
Changes the permissions of an object, property or verb, to those given. The following table shows what permission bits are allowed for each form of the command:
object-permissions
r, w
property-permissions
r, w, c
verb-permissions
r, w, x, d

See the LambdaMOO Programmer's Manual for their meanings. To clear all of the permissions for an object, verb, or property, use "" as the second argument.

Command: @chparent object to new parent
Changes the parent of the named object to be the named parent. The object acquires all the verb and property definitions of its parent, as well as the parent's values for any newly-defined properties. The parent object must be readable by the player in order to use it as a new parent.

Dealing with Verbs

The following commands are used for creating and manipulating verbs.

Command: @verb object:verb-name(s)
Command: @verb object:verb-name(s) dobj [prep [iobj]]
Command: @verb object:verb-name(s) dobj prep iobj permissions
Command: @verb object:verb-name(s) dobj prep iobj permissions owner
Adds a new verb with the given name(s) to the named object. If there are multiple names, they should be separated by spaces and all enclosed in quotes:
@verb foo:"bar baz mum*ble"

The direct and indirect object specifiers (dobj and iobj) must be either `none', `this', or `any'; their meaning is discussed in the LambdaMOO Programmer's Manual. The preposition specifier (prep) must be either `none', `any', or one of the prepositional phrases possible. (a prepositional phrase with more than one word must be enclosed in quotes ("")). All three specifiers default to `none'. It is also possible to specify the new verb's permissions and owner as part of the same command (rather than having to issue separate `@chmod/@chown' commands), using the third and fourth forms above. permissions are as with @chmod, i.e., must be some subset of `rwxd'. They default to `rxd' (specifying `w' for a verb is highly inadvisable). The owner defaults to the player typing the command; only wizards can create verbs with owners other than themselves.

Command: @rmverb object:verb-name
Removes the named verb from the named object.
Command: @args object:verb-name dobj
Command: @args object:verb-name dobj prep
Command: @args object:verb-name dobj prep iobj
Changes the direct object, preposition, and/or indirect object specifiers for the named verb on the named object. Any specifiers not provided on the command line are not changed. The direct and indirect object specifiers (dobj and iobj) must be either `none', `this', or `any'. The preposition specifier (prep) must be either `none', `any', or one of the prepositional phrases that are possible.
Command: .program object:verb-name
Provides or changes the MOO program associated with the named verb on the named object. This command works differently from all other MOO commands, in that it actually changes how the server will interpret later lines that you type to it. After typing the `.program' line, you are in programming mode. All lines that you type in this mode are simply saved away in the server until you type a line containing only a single period (`.'). At that point, those lines are interpreted as a MOO program and are checked for syntax errors. If none are found, a message to that effect is printed and the code you typed is installed as the program for the verb in question. In any case, after typing the `.' line, you are returned to the normal input-handling mode.
Command: @list object:verb
Command: @list object:verb with parentheses
Command: @list object:verb without numbers
Command: @list object:verb with parentheses without numbers
Prints out the code for the MOO program associated with the named verb on the named object. Normally, the code is shown with each line numbered and with only those parentheses that are necessary to show the meaning of the program. By specifying options as shown in the last three forms above, you can have the numbers omitted and/or all parentheses included. For example,
@list $room:@move

to see the code for the `@move' command, or even

@list $prog:@list

to see the code implementing @list itself.

Command: @edit object:verb-name
Enters the MOO Verb Editor for the named verb on the named object.
Command: eval MOO-code
Command: ; MOO-code
Evaluates the given piece of MOO code and prints the resulting value. If the MOO code begins with one of the MOO language keywords (`if', `for', `while', `fork', or `return') or with the character `;', then the entire piece of code is treated as the program for a verb, with `;' appended to the end. Otherwise, `return' is appended to the front and `;' is appended to the end and that string is treated as the code for a verb. In either case, the resulting verb is invoked and whatever value it returns is printed. For programmers, this is such a mind-bogglingly useful thing to do that there is a simple abbreviation for this command; any command beginning with a semicolon (`;') is treated as a use of `eval'. For example:
>eval 3 + 4
-|7

>;3+4
-|7

>;for x in (player.aliases) player:tell(x); endfor
-|Haakon
-|Wizard
-|ArchWizard
-|0

;;l = {}; for i in [1..10] l = {@l, i}; endfor return l
-|{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}

Prepositions

The complete list of prepositions recognized by the command-line parser is shown in the list below:

Dealing with Properties

The following commands are used for dealing with properties.

Command: @property object.prop-name
Command: @property object.prop-name initial-value
Command: @property object.prop-name initial-value permissions
Command: @property object.prop-name initial-value permissions owner
Adds a new property named prop-name to the named object. The initial value is given by the second argument, if present; it defaults to 0. Normally, a property is created with permissions `rc' and owned by whoever types the command. However, you may also specify these explicitly, using the third and fourth forms. Only wizards can create properties with owners other than themselves. `@property' can be abbreviated as `@prop'.
Command: @rmproperty object.prop-name
Removes the named property from the named object. `@rmproperty' may be abbreviated as `@rmprop'.


Go to the first, previous, next, last section, table of contents.