CALYX2.ADL
calyx2.adl is a file that contains many useful default definitions
and routines. To use calyx2.adl, simply put 'INCLUDE "calyx2.adl"' before
the rest of your program.
Calyx2.adl is widely based on Ross Cunniff's standard.adl (as is this
documentation), but removed some of its errors and offers a lot more
predefined standards. It is unfortunately NOT compatible to standard.adl.
See section 6 for further information concerning this.
Calyx2.adl defines six things: object properties, constants,
global variables, useful words, some normal verbs and their actions, and
some utility routines.
1. Object properties
The following object properties are defined in calyx2.adl. The ADL
programmer using calyx2.adl is advised not to re-use these properties
with different meanings, as strange and unusual things will happen.
SEEN = 16;
OPENS = 15;
OPENED = 14;
TRANS = 13;
INCAP = 12;
ONCAP = 11;
LIGHT = 10;
FLAME = 9;
NOTAKE = 8;
ACTIVE = 7;
AllLink = 29;
SAVESENT = 28;
This leaves boolean properties 1 through 6 and integer properties
17 through 27 free for the programmer's definition and use. The above
properties are used as follows:
SEEN The standard looking daemon sets this property of a room to
TRUE whenever the player visits the room.
OPENS This property should be set to TRUE if it is possible to
open or close the object (a treasure chest would be an example of
this).
OPENED This property is set to TRUE if the object is already
opened and FALSE if the object is closed. This is meaningful only if
OPENS is TRUE.
INCAP This property is set to TRUE if an object has an "in"
capacity, but cannot be opened or closed. A sink or a cup are good
examples for this.
ONCAP This property is set to TRUE if the referred-to object has
an "on" capacity, i.e. you can put other things on top of it.
IMPORTANT: At this time of standard, an object may only have
EITHER an INCAP, OR an ONCAP!
TRANS This property should be set to TRUE if the object is
transparent (a glass box or a bottle would be a good example of
this).
LIGHT This property should be set to TRUE if the object gives off
light (in the case of a transportable object like a flashlight) or if
the object is intrinsically lit (like an outdoor location).
FLAME This property should be set to TRUE if the object is on
fire.
NOTAKE This property should be set to TRUE if it is desired that
"take" and "drop" ignore the object when "take all" or "drop all" are
requested.
ACTIVE This property marks that an object is "active." This can
mean that it is currently switched on, locked, or used in some other
way.
AllLink This property is used by the PREACT and ACTION routines of
the verbs "take" and "drop" and should not be used by anything else.
SAVESENT This property is used to hold the starting number of a
block of six global variables in which to store a sentence for use
with ActAction, below.
2. Constants
For convenience and readability, calyx2.adl defines the following
constants:
TRUE = 1;
FALSE = 0;
NULL = 0;
ON = 1;
OFF = 0;
In addition, the following constants are defined for use as arguments
to the $spec routine:
DEBUG = 1;
RESTART = 2;
QUIT = 3;
SAVE = 4;
RESTORE = 5;
EXEC = 6;
PRESERVE = 7;
SCRIPT = 8;
HEADER = 9;
MARGIN = 10;
The following constants are defined for use as arguments to the
Expect routine (described in section 10.6):
NO_OBJ = 1;
ONE_OBJ = 2;
MULT_OBJ = 4;
PLAIN_OBJ = 8;
STR_OBJ = 16;
The following global variables are declared by calyx2.adl for use by
the ADL programmer:
First,
AllSeen,
MultList,
MyConj,
NumSeen,
IobjSave,
Skip,
Scripting,
Cloak,
Conts,
Indent,
LastVerb,
LastNumd,
LastConj,
LastDobj,
LastPrep,
LastIobj,
Dark,
MyLoc,
Verbose;
The above globals are used as follows:
First is TRUE if the current Dobj is the first in the Dobj list.
It is set to TRUE at the beginning of the game.
AllSeen is TRUE if the player typed "all" in his sentence.
MultList This is the head pointer of the multiple object list.
MyConj records where "but" has been seen.
NumSeen NumSeen contains the number of Dobj's seen by "take" or
"drop" so far.
IobjSave The Iobj is stored in IobjSave by the "take" and "drop"
routines. If you want to mess around with these you should know
exactly what you are doing. In most of the cases this makes sense
only if you plan to (re)define something in calyx2.adl.
Skip Skip is used in preference to ($exit 1) or ($exit 2) inside
Object ACTIONs if it is desired that the rest of the Object list be
processed by the Verb ACTION of "take" or "drop" (see the discussion
on TakeAct and DropAct below).
Scripting Set to TRUE while scripting to a file.
Cloak This is a flag that is used when you desire an object not to
print the "xyz: taken" line when it is taken, or the appropriate
lines when dropping or putting. This is particularly useful if you
intend to print a special message when taking this object. If you
wish to program similar verbs, make sure that Cloak is set to FALSE
by your verb ACTION.
Conts Conts is TRUE if the "You can see:" message has been
printed. You should set it to TRUE if you desire this message not to
be printed to the screen.
Indent Indent should be set to TRUE if object descriptions are to
be indented by two spaces before being printed. It works, as opposite to
standard.adl's Indent.
Dark Dark is TRUE if it is currently dark. This variable is set
by the Looker routine if there is no light in the current location
of .ME, and may also be set as the result of some other action.
MyLoc MyLoc is the location of the player at the outset of the
previous turn. The routine Looker checks to see whether MyLoc is the
same as the location of the player. If so, the room description is
printed. If not, no action is performed by Looker. MyLoc is
initialized to -1 to force the printing of a room description at the
beginning of the game.
Verbose Verbose should be set to TRUE if the player wishes that
all room descriptions be verbose ones (i.e. long descriptions of the
room and its contents). If Verbose is false and the room has been
visited previously, a short description will be printed.
LastVerb LastVerb, LastNumd, LastDobj, LastPrep, and LastIobj
contain the values present in the sentence prior to the current
sentence. These values are set in the standard looking daemon. The
routine SaveSentence is provided for this purpose.
3. Words
The following words are defined to be a standard part of the ADL
vocabulary:
PREP with, to, into, at, under, from, off, on;
in = into;
ARTICLE the, a, an;
NOUN all, it;
4. Verbs and their actions
Calyx2.adl declares the following verbs, and initializes their PREACT
and ACTION routines to (usually) fairly simply-minded defaults.
n, s, e, w, ne, se, nw, sw, up, down,
enter, exit,
get, put, take, drop,
wear, remove,
verbose, terse,
open, close,
lock, unlock,
move, break, rub, touch,
throw, read, burn,
examine, look, inventory,
quit, restart,
save, restore, script,
turn, douse, light,
wait, again, go;
The following verbs have special semantics and redefinition of their
PREACT or ACTION routines should be avoided:
NOVERB NOVERB (which is predeclared by ADL) is the verb returned
by the parser if the player's sentence contained no verb. Calyx2.adl
initializes the PREACT of NOVERB so that appropriate requests for
more information are generated.
put "Put" transforms itself into "drop" then calls the PREACT of
"drop".
get "Get" transforms itself into "take" then calls the PREACT of
"take".
take "Take" determines whether the sentence is one like "Take all
but the sword and the shield". If it is then a list of objects is
built up which are then taken. If not, the normal semantics apply. If
the programmer wants an action to be performed by the "take" ACTION,
the routine TakeAct should be defined.
drop "drop" may be used in sentences like "Drop all but the
book." If it is so used, a list of objects is created which are then
dropped. If the programmer wants an action to be performed by the
"drop" ACTION, the routine DropAct should be defined.
go If "go" is used in a sentence like "Go north", the Verb is
changed to "north" and the Dobj and Iobj are set to NULL. This only
applies to the direction verbs "north", "south", "east", "west",
"northeast", "southeast", "northwest", "southwest", "up", and "down".
again If the standard actor action is in effect, the Verb "again"
will never be called or seen by Objects since it is replaced by the
previous sentence.
In addition, there are some remarks to be made on the following verbs:
enter, As opposite to the standard.adl verbs of the same name,
exit these two now actually DO something. It is checked if the
referred-to object is actually available, and then a "Silly" (see there)
message is printed out.
lock, The predefined ACTION prints out a message like "You can't
unlock do that." If the programmer desire that an object can
actually be locked, he has to define this in the appropriate object
ACTION. The predefined property ACTIVE can be used as a flag.
In addition to declaring the preceding verbs, calyx2.adl declares the
following equivalencies:
g = again;
z = wait;
x = examine;
i = inventory;
l = look;
u = up;
d = down;
north = n;
south = s;
east = e;
west = w;
northeast = ne;
northwest = nw;
southeast = se;
southwest = sw;
brief = terse;
put on = wear;
take off = remove;
turn on = light;
turn off = douse;
look at = examine;
5. Routines
Calyx2.adl declares and defines the following Routines for use by the
ADL programmer:
StdInit,
Reach,
See,
Lit,
Avail,
CheckAvail,
Expect,
Preact,
Looker,
Prompter,
TakeAct,
DropAct,
ActAction,
SaveSentence,
Dwimmer,
ClS,
ObjCont,
Silly;
Their use is defined as follows:
StdInit (StdInit actor) should be executed in START if the
programmer desires that ALL of the default routines be used. Actor
should be the name of the primary interactive Actor in the scenario.
Reach (Reach object container) is TRUE if object is contained in
container and if the player can reach the object. It is FALSE
otherwise. Note that this also checks whether object is contained in
something which is contained in container and so on.
See (See object container) is TRUE if object is contained in
container and the player can see the object. It is FALSE otherwise.
This also checks containers inside containers.
Lit (Lit) is TRUE if something is lighting the player's location
and FALSE otherwise.
Avail (Avail object) is TRUE if the player can see object (either
in the room or in the player's inventory) and can reach the object.
It is FALSE otherwise.
CheckAvail (CheckAvail) checks to see whether the Dobj and Iobj
typed by the player are available. If not, an appropriate message is
printed and ($exit 1) is performed.
Expect Expect is typically called by the PREACT of a Verb. It
looks at the current sentence to see whether it is of acceptable
form. The two parameters to Expect define criteria for acceptability.
The first parameter indicates what types of direct objects are
acceptable and the second indicates what types of indirect objects
are acceptable. Each parameter consists of one or more of the Expect
flags $or'd together. The flag NO_OBJ indicates that it is acceptable
that no object be present; ONE_OBJ indicates that it is acceptable
that one object be present; MULT_OBJ indicates that it is acceptable
that multiple objects be present; STR_OBJ indicates that it's OK for
the object(s) to be strings; and PLAIN_OBJ indicates that it's OK for
the object(s) to be normal ADL objects.
Example:
{ "take" needs 1 to N Dobjs and 0 or 1 Iobjs }
take(PREACT) =
(Expect ($or MULT_OBJ PLAIN_OBJ)
($or NO_OBJ ONE_OBJ PLAIN_OBJ))
;
{ "quit" can accept no objects }
quit(PREACT) =
(Expect NO_OBJ NO_OBJ)
;
{ "unlock" needs exactly one Dobj and Iobj }
unlock(PREACT) =
(Expect ($or ONE_OBJ PLAIN_OBJ)
($or ONE_OBJ PLAIN_OBJ) )
;
{ "say" needs a string to say and possibly
someone to whom to say it }
say(PREACT) =
(Expect ($or ONE_OBJ STR_OBJ)
($or NO_OBJ ONE_OBJ PLAIN_OBJ))
;
Preact Preact is the standard PREACT for Verbs. It checks to make
sure that exactly one plain Direct Object was typed and that the
Indirect Object is not a string. It also checks to see whether all of
the named objects are available.
Looker Looker is the standard looking daemon. It is intended to be
executed every turn. To enable this, either of the statements ($sdem
Looker) or (StdInit actor) must be executed (where actor) is the
primary actor).
Prompter Prompter is the standard prompting routine. To use it,
either of the statements ($prompt Prompter) or (StdInit actor) must
be executed.
ActAction ActAction is the standard Actor action. It checks to see
whether the Verb "again" or the Object "it" was used and modifies the
sentences appropriately. To use it, either of the statements ($setp
.ME ACTION ActAction) or (StdInit actor) must be executed.
TakeAct TakeAct is called by the default action routine of the
Verb "take" after the ACTION routines of all of the Direct Objects
have been executed.
DropAct DropAct is similar to TakeAct, except that it is called by
the ACTION routine of "drop".
SaveSentence SaveSentence should be called by the ADL programmer
if it is desired that the Verb "again" and the Object "it" work as in
ActAction above. Looker calls SaveSentence every turn.
Dwimmer Dwimmer is the standard DWIMming routine. It checks to see
whether an ambiguous object could possibly be the one the player
meant. To use Dwimmer, include the statement (IF (Dwimmer %1) THEN
($return 1)) in DWIMI and/or DWIMD.
ClS Prints out 26 blank lines, which to my experience is enough
for most screen formats to be utterly cleared. If this should not be the
case, at least there'll be a proper spacing between texts.
ObjCont Called in an object ACTION, this routine checks if the
current Dobj is openable, or has an in- or oncapacity and prints out
its contents, if available. Everything is checked for that cause, so
the programmer just has to call the routine. If an object doesn't
define its own reaction to "examine", ObjCont is automatically
called by the examine ACTION.
Silly Randomly prints out one of five messages equivalent to "That's
silly."
6. Converting standard.adl files to calyx2.adl files.
To convert files, you have to reassign some object properties. LOCKS
and LOCKED cannot be used now (they didn't make sense if you also want
to check for a key; you'd have to define the appropriate verb ACTION
anyway), so you have to reprogram objects using these (you can
alternatively use ACTIVE). If you have objects that seem suitable for
the new INCAP or ONCAP properties, feel free to add these.
The internal program structure will not change. If you want old
containers to show their contents when examined, you can simply put the
ObjCont routine to their ($eq @Verb examine) part. You MUST do this if
there are any objects that don't have a special routine for ($eq @Verb
examine) implemented, because else the continuity will be seriously
disturbed, as calyx2.adl assumes ObjCont to be executed in the
predefined examine verb ACTION.
Note that several routines that didn't work correctly with standard.adl
(e.g."put cup into cup," or putting something into a closed container)
will now work properly without you having to change anything there.
7. Contacting the author and legal stuff.
It's been a while since I have written calyx2.adl. Since I don't intend
to work further on it, it is placed in the public domain. Please mention
the original file, along with its version number, if you change the
standard.
If you have questions, you can contact me (as of this writing,
1996/JAN/23) as:
Miron Schmidt
Eibischstr.9, 12357 Berlin, GERMANY
Tel.: (+49 30) 661 79 25
email:
[email protected] (until at least 1998)
I wrote all this for the Amiga version of ADL, and I don't know if there
exist any differences to other ports.
As I haven't coded ADL for a while, I cannot guarantee that I'll be able
to help you, but you're invited to contact me anyway. :)
Don't ask me about Calyx Corp. I founded Calyx in my late childhood,
when I wanted to publish games for the C-64, and out of habit I keep
using the name for my IF publications.
Finally, I hope anybody can do anything with this. Taking the time of
its writing into consideration, ADL is a fine piece of work, so I
wouldn't be surprised if there were still any programmers using it out
there.