Function and Verb Calls

Built into the MOO server are several blocks of code that perform some simple operations. These are functions. Also, any verb can be flagged as "callable" and then called in code. Function and verb calls have the same syntax; the only difference is that callable verbs are on an object, and functions are not.

Verb Calls

The basic syntax for a verb call is:

object:verb(arg1, arg2...)

We're starting here because you've already seen several verb calls. For instance:

player:tell("This is a message sent to whoever typed the command to start this verb.");

In this case, "player" is the object, "tell" is the verb, and it's been given one string argument: the message you see in quotes.

Definition: Arguments are pieces of information that are passed, or sent to, a function or verb. Often you must pass a specific number of arguments of specific types. Others, like player:tell(), take any number and type.


Function call syntax:

function(arg1, arg2...)

Functions, as part of the server code, usually perform simple and basic operations. For instance, the notify() function sends text to a connection. The :tell() and :announce() verbs ultimately call notify(), using it in different ways.

One useful function is suspend(). It takes a single integer argument, and pauses the verb for the number of seconds given. For instance:


Try going back to your ball:bounce verb and having it suspend for a second or two between bounces.

Function and Verb Lists

There are too many functions and callable verbs to provide a complete list. Look near the end of this guide for places to find some of these. Also, several more will be used in later examples.