TinyMUD 2.4 Quick Reference Sheet
 
Order of command parsing:

verb                        calls verb on room or player
object                      calls _invoke on object
verb object                 calls verb on object

verb object1 prep object2   calls verb<prep on object1 or verb>prep on object2
                             $text is set to other object

verb text                   calls verb on room or player with
                             $text set to text

text                        calls _default on room or player with
                             $text set to text

Variables:

x	object
?x      boolean
$x      string
%x      number
&x      action
@x      set
~x      time

'.' may be used as a dereferencing operator, e.g. 

 george.last_victim.girlfried.mother.hairdresser.$name

gets the name of george's last victim's girlfriend's mother's
hairdresser.

Certain variable-like expressions have special meaning; see below.


Special variables (cannot be set):

me          object performing an action
            variables which are not specified with a '.' are always
            relative to me, e.g. $name is equivalent to me.$name

you         player who invoked the action
next        loop iteration variable
$text       unparsed text from command line
~time       current time
%id         id number of object or string, e.g. me.%id, me.$name.%id, "foo".%id
%count      counts contents list
@x.%count   counts elements in set
%random     random number
?true       true boolean value
?false      false boolean value
nothing     the null object
$null       the null string
location    location of an object, e.g. george.location

create      returns a new object each time it is called, owned by the
            caller, or nothing if the caller does not have ?wizard set.

System variables:

?player     this object is a player; can be set only by ?wizard objects
?builder    meaningless flag; can be set only by ?wizard objects
?programmer player can use @ command, settable only by ?wizard objects

?wizard     object controls all non-administrator objects;
             can be set only by ?admin objects

?admin      object cannot be controlled by any other object, has
             certain special privileges.
        
?connected  object is connected; maintained by the system,
             settable only by ?admin objects

?paranoid   tells to this object are annotated with their source

?open       if ?true, objects can be moved into this object freely
            without normal destination restrictions

owner       owner of an object; can be set only by ?wizard objects

parent      object from which an object inherits methods
            and non-set variables.
            
$aliases    strings which lists aliases, separated by '|'


Arithmetic operators:

+, -, and mod are unusual in that they can be used on times:

n + m       yields a number
~t + n      yields a time (~t plus n seconds)
n + ~t      yields a time
n - m       yields a number
~t - n      yields a time
~t - ~s     yields a number (number of seconds between ~s and ~t)
n mod m     yields a number
~t mod n    yields a number (~t mod 60 = secs; ~t mod 3600 / 60 = min., etc.)

The following work only on numbers:

* /         multiplication and division
unary -


String operators:

|          concatentation, e.g "foo" | 2 yields "foo2"


Comparison operators:

< > <= >=    can be used on numbers or times;
             ~s < ~t means ~s is earlier than ~t

= !=         work on any two expressions of the same type


Logical operators:

!            (logical negation)
and or       evaluate their right-hand argument only if necessary

Predicates:

$x matches y    true if $x is a name of y
x contains y    equivalent to y.location = x
@x contains y   true if y is an element of @x

Statements:

All statements return ?true if they are successful, ?false otherwise.

set <var> to <value>        sets a (non-set) variable, e.g.
                             set location.$name to "Fred's Place."
clear <var>                 removes a variable, e.g.
                             clear location.$name
                            when a variable has been cleared it no
                            longer shadows inheritance

clear @x                    sets @x to the empty set
add x to @y                 sets @y to @y union {x}
take x from @y              sets @y to @y - {x}

move x to y                 attempts to move x to y

tell <string-list> to y     string-list is a sequence of expressions
                            of any type except object or boolean,
                            separated by spaces.

delay ~t                    sends _tick method at time ~t
delay t                     sends _tick at time ~time + t

destroy x                   destroys the object; only usable by wizards.


Control:

The following two forms can be used to iterate over contents lists or
set variables, possibly touching only those elements matching a given
string.  The next special variable returns the current object in each
iteration.  Loops may not be nested.

in x [matching $y] do <statements> end
in @x [matching $y] do <statements> end

break                       (exit the containing loop immediately)

if ?x then <statements>
 [elseif ?y then <statements>]* [else <statements>] endif