Programming: Verbs

  1. Properties
  2. Programming
  3. Editing Properties and Verbs

Verbs are the ‘commands’ of the MOO. You’ve been using verbs left and right. When you ‘look’ or ‘go’, when you talk, emote, page, or whisper, you’re using verbs.

Classes of Objects

Verbs must be attached to objects, whether the object is a player, a room, or some thing. Verbs should be attached to appropriate objects. If you have a cat named Lucretia, and you want people to be able to kick it, you should attach the kick verb to Lucretia, and not the room you happen to be in. People are going to want to kick your cat no matter where they find it. A kick verb on a room might be appropriate if the room is a kick-boxing arena.

MOO is an object oriented programming language. This means that it has classes of objects. When you look at the parents of an object, you’re looking at the classes that the object belongs to.

@parents Lucretia

Lucretia(#392) generic cat(#259) generic animal (#258) generic thing(#5) Root Class(#1)

Lucretia is a member of the class generic cat. Cats, in general, are members of the class generic animal, which are members of the class generic thing. Everything in the MOO is based on the Root Class.

Suppose you type kick Lucretia. Assuming that there is no kick verb on you or on the room you are in1, the MOO looks to see if Lucretia has a kick verb. If she does, the MOO ‘runs’ that kick verb. If not, the MOO checks to see if cats can be kicked; then, it checks animals, and then things, and finally the Root Class.

This order of verb-searching means that higher-order objects can override verbs in lower-order objects. If both generic thing and generic cat have a kick verb, only the verb on generic cat is used by the MOO.

Sentence Structure

There are three basic sentence forms in MOOs:


verb direct-object

verb direct-object preposition indirect object

When you create a verb, you need to tell the MOO what kind of sentence the verb belongs in, and what kind of direct or indirect objects are allowed. For example,

@verb here:cough none none none

creates a cough verb in the current room. The cough verb only works if the player doesn't type anything except ‘cough’.

@verb staff:swing this at any

creates a swing verb on the staff. This verb needs the direct object to be the staff (this), the preposition to be at1, and the player must swing it at something, although this something can be anything.

The LambdaMOO Programmer’s Manual discusses verbs in much more detail. The important thing to remember here is that, when the MOO starts looking for a verb, it basically ignores any verbs whose sentence structure doesn't match what the player typed. If the player types cough loudly, the MOO will not use the cough verb we created above. If the player types swing staff in time, the MOO will not use the swing verb we created.

In both cases, if the MOO doesn't find an appropriate verb/sentence structure combination, it will make suggestions to the player. In the above examples, we might expect:

cough loudly

I don't understand that.

Try this instead: cough

swing staff in time

I don't understand that.

Try this instead: swing staff to time

  1. Properties
  2. Programming
  3. Editing Properties and Verbs