Boolean Expressions in UnterMUD

UnterMUD booleans are generally similar to TinyMU* booleans with some
extensions.  They are primarily able to test for the identity of a
player or the presence of some object.  This is a result of their
heritage as locks for exits where the main issue is who it is and
whether they have the "key(s)".

VALUES

UnterMUD boolean expressions are composed of values, relational
operators and grouping.  Values are of two types, objects (names or
OID's) and the special constants ('T' or 'F').  Objects in a boolean
expression are implicitly checked for presence either as the actor, in
their inventory or at the same location.  The special constants 'T' and
'F' stand respectively for true and false, they are primarily useful
for degenerate cases (e.g. boo lnk=T).

OPERATORS

The relational operators supported are '&', '|', '!' and 'with'. 
Operator '&' is generally thought of as "and", however it's probably
closer to "carrying or using" in many cases, it is a binary operator. 
Operator '|' is "or", it is a binary operator.  Operator '!' is "not",
it is a unary operator.  Operator 'with' checks if it's operand is an
object or player at the same location as the actor, it is a unary
opertator.

GROUPING

Two types of grouping are available.  The quotes ' and " provide token
grouping for names with spaces or odd characters embedded in them, the
escape character \ is also available to use with special characters. 
Parentheses () provide logical grouping and control order of evaluation.

VALIDATION

When a user sets a boolean the expression is checked and rewritten. 
Any objects specified by name are resolved to OID's which are validated
for existance (the player or object MUST EXIST IN THE LOCAL DB for you
to use their OID in setting a bool) and any relational operators are
checked to ensure that each operator has the proper numer of values.

EXAMPLES

Below are some examples with brief explainations, they assume that there
are two two players UnterWiz (wizard) and testbozo (22@DEEPMUD) and two
objects frisbee (21@DEEPMUD) and bat (20@DEEPMUD).

T					Always
!testbozo				not testbozo
testbozo | UnterWiz			either testbozo or UnterWiz
22@DEEPMUD & 20@DEEPMUD			testbozo carrying bat
frisbee					anyone carrying frisbee
UnterWiz | bat				UnterWiz or anyone carrying bat
wizard & (21@DEEPMUD | 20@DEEPMUD)	UnterWiz carrying frisbee or bat
with 22@DEEPMUD 			testbozo in the room

If UnterWiz set a lock on the exit "up" to allow him/her and the
testbozo to use it but not take the frisbee:

set up lock "(testbozo | me) & !frisbee"

The result looks like this in the OIF:

boo lok=(22@DEEPMUD|wizard)&!21@DEEPMUD


SUMMARY

what	type	meaning
--------------------------
<OID>	object	test objects presence
T	const	true
F	const	false

!	unary	not
|	binary	or
&	binary	and (carrying or using)
with	unary	here (in the same room)

()	group	evalute contents as a unit
""	quote	make a single token with expansion
''	quote	make a single token without expansion
\	escape	ignore special meaning of next character