Contents | Index | < Browse | Browse >
2.1. Objects
As in most Adventure-like games, the most important
data type in ADL is the Object. An object in real life can
be a person, place, or thing. ADL models the world in the
same way. Any Object encountered by the player is
represented by this type, as are all locations in the
scenario. Indeed, there can be Objects associated with peo-
ple (more on that later). Notice that ADL treats all
Objects uniformly and so it is possible to write a scenario
in which a player picks up an Object (a tent, say), carries
it around, and later enters it.
All Objects are represented by (unique) sixteen-bit
integers. This number is known as the "Object ID" of the
Object. Objects are (essentially) record structures with
the following elements:
Location The Object ID of the Object which contains
this Object.
Contents The Object ID of the first Object which is
contained in this Object, or zero if there is
no such Object.
Link The Object ID of the next Object which is
located in the same place as this Object or
zero if there is no such Object.
Modifier The ID of the modifier of this Object or zero
if the Object has no modifier. For example,
the Object "blue streak" would have a modifier
ID which is the adjective "blue". Modifiers
are explained further in Section 2.9.
Properties Associated with each Object are 32 properties.
While all of the above elements are maintained
directly or indirectly by the ADL system, the
values and meanings of properties are the
responsibility of the programmer. The first
16 of these properties may only hold the value
0 or 1 (hence they are usually called
"boolean" properties). Properties 17 through
32 may hold any value between -32768 and
32767. The last three of these properties
have special meaning to ADL:
LDESC (30) This is the ID of a routine
which prints a "long" descrip-
tion of the Object. Routines
are defined in Chapter 6.
SDESC (31) This is the ID of a routine
which prints a "short" descrip-
tion of the Object.
ACTION (32) This is the ID of a routine
which is called under the cir-
cumstances detailed in Chapter
4.
All Objects in ADL are stored in a tree. The root node
of the tree is predeclared and is named ".ALL". Its Object
ID is always zero. All other Objects are ultimately located
in .ALL.
Two other predeclared Objects exist. One is named
"STRING" and the other is named ".ME". .ME is not truly an
Object -- it is more like a variable which represents the
current Actor during the execution of an ADL program (more
on Actors in Section 3.1). It is illegal to use .ME outside
of the context of a routine. STRING is the Object which is
seen by the ADL program when the run-time sentence parser
encounters a string. Note that although STRING is prede-
clared by ADL, the properties of STRING must be defined by
the ADL programmer. See Chapter 9 for more information on
STRING.