"GOAL for
DEADLINE
Copyright 1982 Infocom, Inc. All rights reserved.
"
"This code is the local T system. There are four transit lines:
TOP-OF-THE-LINE, BOTTOM-LINE, FOOD-LINE, and OUTSIDE-LINE,
corresponding to upstairs, downstairs, kitchen area, and outside.
There are routes for each of these lines and transfer points. Much of
this is done for the general case, except transfers. Sigh."
<GLOBAL DIR-STRINGS
These tables define the four “transit lines” which let NPCs travel around the map. Every room is either on or adjacent to a transit line.
<GLOBAL TOP-OF-THE-LINE
<GLOBAL BOTTOM-LINE
SHALL-3 is not a valid room name. (The South Hall contains only SHALL-1 and SHALL-2.) What happened here?
In the compiled table, this value is zero. It seems that this was a double bug: a mistake in the Deadline source that went unnoticed because the ZIL compiler failed to flag it as an undefined symbol.
Since characters only use the transit tables to move to specific rooms, this bad table row doesn’t cause any game problems.
(It’s possible that an early draft of the map had a SHALL-3 room which was removed. That is speculation, however.)
P?WEST SHALL-3 0>>
<GLOBAL OUTSIDE-LINE
<GLOBAL FOOD-LINE
"Rapid Transit Line Identifiers"
<CONSTANT TOP-OF-THE-LINE-C 0>
<CONSTANT BOTTOM-LINE-C 1>
<CONSTANT OUTSIDE-LINE-C 2>
<CONSTANT FOOD-LINE-C 3>
<ROUTINE UNPRIORITIZE (PERSON "AUX" GT)
Set up a character’s GOAL-TABLES entry to move them towards a destination. Normally this is driven by the MOVEMENT-GOALS table. If the PRIORITY argument is set, this is a plot-critical action which overrides the normal schedule.
See the “Schedule” tab for a complete explanation.
<ROUTINE ESTABLISH-GOAL (PERSON GOAL "OPTIONAL" (PRIORITY <>)
"AUX" (HERE <LOC .PERSON>) HL GL GT)
#DECL ((PERSON GOAL HERE) OBJECT (HL GL) FIX
(PRIORITY) <OR FALSE ATOM>)
<COND (.PRIORITY
<COND (<==? <SET HL <GETP .HERE ,P?LINE>>
<SET GL <GETP .GOAL ,P?LINE>>>
(T
<LOC .PERSON>>
Move a character one step towards their current goal. All the work driven by the GOAL-TABLES happens in this routine.
<ROUTINE FOLLOW-GOAL (PERSON "AUX" (HERE <LOC .PERSON>) LINE LN RM GT GOAL FLG
(GOAL-FLAG <>) (IGOAL <>) LOC (CNT 1) DIR)
#DECL ((PERSON HERE LOC RM) OBJECT (LN CNT) FIX
(GOAL-FLAG IGOAL) <OR ATOM FALSE>)
<COND (<==? .HERE <GET .GT ,GOAL-F>>
<RETURN .FLG>)
<COND (<NOT <==? <SET LOC <GETP .HERE ,P?STATION> > .HERE>>
<COND (<SET GOAL <GET .GT ,GOAL-I>>
<SET IGOAL T>)
(T <SET GOAL <GET .GT ,GOAL-S>>)>
<COND (<NOT .GOAL> <RFALSE>)
(<==? .HERE .GOAL>
<COND (.IGOAL
(<NOT <==? .HERE <GET .GT ,GOAL-F>>>
<RETURN .FLG>)
(T
<SET LINE
<REPEAT ()
<COND (<==? <SET RM <GET .LINE .CNT>> .HERE>
<COND (.GOAL-FLAG
<SET LOC <GET .LINE <- .CNT 3>>>)
(T
<SET LOC <GET .LINE <+ .CNT 3>>>)>
(<==? .RM .GOAL>
<SET GOAL-FLAG T>)>
<SET CNT <+ .CNT 3>>>>
<ROUTINE GOAL-REACHED (PERSON)
#DECL ((PERSON) OBJECT)
<ROUTINE MOVE-PERSON (PERSON WHERE "AUX" DIR GT OL COR PCOR CHR NC WT (CNT 0)
(FLG <>) EX)
#DECL ((PERSON WHERE) OBJECT)
<SET NC .CHR>
<SET OL <LOC .PERSON>>
<COND (<==? <PTSIZE <SET EX <GETPT .OL .DIR>>> ,DEXIT>
(T <SET EX <>>)>)
(T <SET EX <>>)>
<SET FLG T>
<TELL D .PERSON>
<TELL " walks out of the room." CR>)
(<EQUAL? .DIR ,P?DOWN> <TELL " is going downstairs." CR>)
(<EQUAL? .DIR ,P?UP> <TELL " is going upstairs." CR>)
<COND (.EX <TELL " opens the " D .EX " and">)>
<TELL " goes into another room.">)
(T
<COND (.EX <TELL " opens the " D .EX " and">)>
<TELL " heads off to ">
<TELL "." CR>)>)
<SET FLG T>
<TELL D .PERSON>
<TELL " is walking past you." CR>)
<TELL " stops here." CR>)
(T <TELL " steps into the room." CR>)>)
<NOT <==? <BAND .COR .PCOR> 0>>>
<SET FLG T>
<TELL D .PERSON
" steps onto the stairs." CR>)
<TELL D .PERSON ", off to ">
<TELL ",">
<COND (.EX
<TELL " opens a door and">)>
<TELL " leaves your view">)
<TELL " darts into the shed">)
(T
<TELL " ducks into a room">)>
<TELL " to ">
<TELL "." CR>)
<TELL D .PERSON
", off to ">
<TELL ", disappears from sight ">
<TELL "up the stairs">)
<TELL "down the stairs">)
(T
<TELL "to ">
<TELL "." CR>)
(T
<TELL D .PERSON " is to ">
<TELL ", heading toward ">
<TELL "." CR>)>)
<NOT <==? <BAND .COR .PCOR> 0>>>
<SET FLG T>
<TELL "To ">
<TELL " " D .PERSON>
<TELL " comes into view from ">)
(T
<TELL " enters the hallway from ">)>
<TELL "." CR>)>)>
<REPEAT ()
(T
.PERSON> T)
(<OR <AND <0? .CNT> .FLG>
.NC
<SET CNT <+ .CNT 1>>)>>
<MOVE .PERSON .WHERE>
.FLG>
<ROUTINE DIR-FROM (HERE THERE "AUX" P L T O)
#DECL ((HERE THERE O) OBJECT (P L) FIX)
<SET P 0>
<REPEAT ()
<COND (<0? <SET P <NEXTP .HERE .P>>>
<RFALSE>)
(<NOT <L? .P ,LOW-DIRECTION>>
<SET T <GETPT .HERE .P>>
<SET L <PTSIZE .T>>
<==? <GETB .T ,REXIT> .THERE>>
<RETURN .P>)>)>>>
<ROUTINE COR-DIR (HERE THERE "AUX" COR RM (PAST 0) (CNT 2))
<REPEAT ()
<COND (<==? <SET RM <GET .COR .CNT>> .HERE>
<SET PAST 1>
<RETURN>)
(<==? .RM .THERE>
<RETURN>)>
<SET CNT <+ .CNT 1>>>
<GET .COR .PAST>>
<ROUTINE GET-COR (NUM)
#DECL ((NUM) FIX)
<COND (<==? .NUM 1> ,COR-1)
<ROUTINE TRANSFER (PERSON IGOAL FGOAL "AUX" V (FLG <>))
#DECL ((PERSON IGOAL FGOAL) OBJECT)
<TELL
"You can hear footsteps on the staircase." CR>
<SET FLG T>)>
<TELL
"You can hear footsteps on the staircase." CR>
<SET FLG T>)>
(T
<SET V
<COND (<==? <GETP .FGOAL ,P?LINE> 0>
(T
.V)>>
<ROUTINE DIR-PRINT (DIR "AUX" (CNT 0))
#DECL ((DIR CNT) FIX)
<REPEAT ()
<TELL "the ">)>
<RTRUE>)>
<SET CNT <+ .CNT 1>>>>
"Here is the code for goal motivation for the various characters.
Each character has a tendency to move from one place to another
at certain times. They all converge on the living room at about
noon."
"Constants used as table offsets for each character, including
the player."
<CONSTANT PLAYER-C 0>
<CONSTANT GARDENER-C 1>
<CONSTANT BAXTER-C 2>
<CONSTANT DUNBAR-C 3>
<CONSTANT GEORGE-C 4>
<CONSTANT MRS-ROBNER-C 5>
<CONSTANT ROURKE-C 6>
<CONSTANT COATES-C 7>
<CONSTANT CHARACTER-MAX 7>
<GLOBAL CHARACTER-DESCS
<TABLE 0
"Mr. McNabb is an elderly Scottish man with a deeply lined face.
He is wearing overalls."
"Baxter is an immaculately dressed middle-aged man with rugged good
looks."
"Ms. Dunbar, wearing a fashionable pants suit, is a rather attractive
woman in her early thirties."
"George is a young man in his mid-twenties. He is poorly dressed in
that each item he is wearing clashes with the others. His attire is
of the highest quality, however. He is wearing various pieces of
jewelry."
"Mrs. Robner is a middle-aged woman of great beauty. She is dressed
in black."
"Mrs. Rourke is a short woman, more than a bit overweight. She is
wearing a maid's outfit."
"Mr. Coates is a rather homely man of advancing years.">>
"Goal tables for the 8 characters (including PLAYER), offset
by the preceding constants, which, for a given character,
is the P?CHARACTER property of the object."
The current movement goal of each character. The scheme is explained in the “Schedule” tab.
<GLOBAL GOAL-TABLES
<TABLE <TABLE <> <> <> <> 1 <> <> I-FOLLOW 4 4>
<TABLE <> <> <> <> 1 <> <> I-BAXTER 4 4>
<TABLE <> <> <> <> 1 <> <> I-DUNBAR 3 3>
<TABLE <> <> <> <> 1 <> <> I-GEORGE 2 2>
<TABLE <> <> <> <> 1 <> <> I-ROURKE 6 6>
<TABLE <> <> <> <> 1 <> <> I-COATES 2 2>>>
The current attention level of each character. This is set positive if you call their name or do something else which calls GRAB-ATTENTION. It then decreases every turn (I-ATTENTION) to zero, at which point they wander off.
(In fact the values in this table decrease every turn, becoming negative. Negative values are ignored. For simplicity, I display negative values as “0” in the Schedule tab.)
<GLOBAL ATTENTION-TABLE <TABLE 0 0 0 0 0 0 0 0>>
"Offsets into GOAL-TABLEs"
<CONSTANT GOAL-F 0>
<CONSTANT GOAL-S 1>
<CONSTANT GOAL-I 2>
<CONSTANT GOAL-LDIR 3>
<CONSTANT GOAL-ENABLE 4>
<CONSTANT GOAL-PRIORITY 5>
<CONSTANT GOAL-QUEUED 6>
<CONSTANT GOAL-FUNCTION 7>
<CONSTANT ATTENTION-SPAN 8>
<CONSTANT ATTENTION 9>
"Goal-function constants, similar to M-xxx in MAIN"
<CONSTANT G-REACHED 1>
<CONSTANT G-ENROUTE 2>
"Here's how the movement goals are done: For each player is
a table which consists of triplets, a number of minutes until
the next movement (an clock interrupt number), a number of
minutes allowed variation (for a bit of randomness), and a
room toward which to start. All movement is controlled by
the GOAL-ENABLE flag in the GOAL-TABLE for a character."
"Time starts at 8AM. Characters are at that point in their
starting positions, as reflected in DUNGEON."
<GLOBAL CHARACTER-TABLE
<GLOBAL GLOBAL-CHARACTER-TABLE
The day’s schedule for each character.
Each character (other than the player and Coates) has a list of movement times and goals. A line 30 10 DINING-ROOM means that they will wait 30±10 minutes (20 to 40) and then begin moving towards the DINING-ROOM.
<GLOBAL MOVEMENT-GOALS <TABLE
<TABLE 0 0 0>
<TABLE 0
0>
<TABLE 0
When Baxter reaches the South Lawn, he leaves the game.
360 10 SOUTH-LAWN
0>
<TABLE 0
0>
<TABLE 0
0>
<TABLE 0
0>
<TABLE 0
0>>>
<ROUTINE START-MOVEMENT ()
The timer for McNabb noticing (and raging about) the garden holes. This is queued up when he first enters the ROSE-GARDEN.
<ROUTINE I-G-I-G ()
<TELL
"All of a sudden, Mr. McNabb starts talking to himself quite
loudly about his poor roses being ruined. He walks up to you and
says \"You canna believe the holes someone's made. Crushed my
roses. It'll take me plenty a time to set it right. I just
canna believe it!\" He shakes his head dejectedly." CR>)>>
<ROUTINE I-GARDENER ("OPTIONAL" (GARG <>) "AUX" (GL <LOC ,GARDENER>))
<RFALSE>)
<TELL
"McNabb comes over to you and takes the ladder. He walks off
toward the orchard." CR>
<RTRUE>)
<TELL
"McNabb picks up the ladder and walks away toward the orchard." CR>
<RTRUE>)
<TELL
"McNabb places the ladder he was carrying on the ground." CR>
<RTRUE>)>
<RFALSE>)>)
<RTRUE>)
(T
<RFALSE>)>)>)>>
<ROUTINE I-BAXTER ("OPTIONAL" (GARG <>) "AUX" (BL <LOC ,BAXTER>))
<RFALSE>)>)
<TELL
"Baxter looks at the body of Ms. Dunbar, lying on the floor, and
falls to his knees. He starts to sob. \"I knew she would do this,\"
he says, sobbing, \"but I couldn't stop her. She killed Marshall.
She just told me a few minutes ago. She said that he was going to fire her,
just like that, after all of these years. She was so hysterical,
I couldn't understand everything she said, something about having
stolen some money. I don't know.\" With that, he breaks down again." CR>
<TELL
"The sound of quick footsteps precedes someone into the shed.
You can make out two voices in rapid conversation. The voices
are muffled, however, and cannot be made out." CR>)>)
<TELL
"A limousine comes up the drive and picks up Mr. Baxter." CR>
<RTRUE>)
<TELL
"To the south, you observe a limousine picking up Mr. Baxter." CR>
<RTRUE>)>
<RFALSE>)>>
<ROUTINE I-DUNBAR ("OPTIONAL" (GARG <>) "AUX" (DL <LOC ,DUNBAR>))
<TELL
"You hear soft footsteps approaching. Someone has entered the shed!" CR>)>)>>
<ROUTINE I-GEORGE ("OPTIONAL" (GARG <>) "AUX" (GL <LOC ,GEORGE>))
<RFALSE>)
<TELL
"George walks over to his stereo and puts on a record. He turns
to you. \"I naturally assume that you would like to hear a
" ,TUNE-ON ".\" he says, barely concealing his clear distaste
for you and your profession." CR>)>)
<TELL
"You catch, out of the corner of one eye, George motioning with
his arm toward the lake." CR>)>)
<ROUTINE I-ROURKE ("OPTIONAL" (GARG <>))
<RFALSE>)
<ROUTINE I-MRS-ROBNER ("OPTIONAL" (GARG <>) "AUX" (ML <LOC ,MRS-ROBNER>))
<TELL
"Mrs. Robner stares in complete surprise at the hidden closet. \"I had
no idea that such a place existed!\" She sits down on her bed." CR>)>)>)
<CONSTANT MG-ROOM 0>
<CONSTANT MG-TIME 1>
<CONSTANT MG-VARIATION 2>
<CONSTANT MG-LENGTH <* 3 2>>
<CONSTANT MG-NEXT 4>
Prepare a character to move towards their next destination. The character’s timer routine calls this when it is time for them to “wake up” and move.
This calls ESTABLISH-GOAL to set up their movement. Then they advance one line on their MOVEMENT-GOALS table and set a long timer (30 or 60 minutes or whatever) – the delay until their next wake-up call.
<ROUTINE IMOVEMENT (PERSON INT "AUX" TB VAR DIS TIM ID RM GT)
#DECL ((PERSON) OBJECT (TB) <PRIMTYPE VECTOR> (ID VAR DIS TIM) FIX)
<COND (<NOT <==? <SET RM <GET .TB ,MG-ROOM>> 0>>
(T
<COND (<NOT <==? <SET TIM <GET .TB ,MG-TIME>> 0>>
<SET DIS <RANDOM <* .VAR 2>>>
<QUEUE .INT <+ .TIM <- .DIS .VAR>>>
<COND (<NOT <==? <GET .TB ,MG-NEXT> 0>>
<PUT .TB
<+ <GET .TB ,MG-NEXT> <- .VAR .DIS>>>)>)>
<RFALSE>>
Move each character towards their current goal, if they ought to be in motion.
<ROUTINE I-FOLLOW ("AUX" (FLG <>) (CNT 0) GT)
<REPEAT ()
<RETURN>)
<SET FLG T>)>)>>
.FLG>
This timer routine decreases each character’s attention level after you call their name or do something else which calls GRAB-ATTENTION. These values are stored in ATTENTION-TABLE. After two to six minutes, they will become impatient and leave.
<ROUTINE I-ATTENTION ("AUX" (FLG <>) (CNT 0) ATT)
<REPEAT ()
" starts to move about distractedly." CR>
<SET FLG T>)>)
(<==? .ATT 0>
.FLG>
<ROUTINE GRAB-ATTENTION (PERSON "AUX" (CHR <GETP .PERSON ,P?CHARACTER>) GT ATT)
#DECL ((PERSON) OBJECT (ATT) FIX)
<COND (<==? .ATT 0>
<RFALSE>)
<RTRUE>>
This tracks when each character last saw each other character. This lets you ask questions like DUNBAR, WHERE IS GEORGE? (You won’t get the location, but you will get a time.)
<GLOBAL WHERE-TABLES
<TABLE <TABLE 0 0 0 0 0 0 0 0>
<TABLE 0 0 0 0 0 0 0 0>
<TABLE 0 0 0 0 0 0 0 0>
<TABLE 0 0 0 0 0 0 0 0>
<TABLE 0 0 0 0 0 0 0 0>
<TABLE 0 0 0 0 0 0 0 0>
<TABLE 0 0 0 0 0 0 0 0>
<TABLE 0 0 0 0 0 0 0 0>>>
<ROUTINE I-COATES ("OPTIONAL" (RARG <>))
<TELL
"A car pulls up the drive. Coates enters the vehicle, motions
to the driver, and the car starts up and leaves the grounds." CR>)>)
<TELL
"Mr. Coates shakes your hand. \"I'm glad you're here, Inspector.
We'll begin the reading soon.\"" CR>)>