| ANSWER TO EXERCISE 28 | |
|
This is similar to the previous exercises. One creates an attribute called crewmember and gives it to the crew objects: the orders property is
orders
[; Examine:
if (parent(noun)==0)
"~", (name) noun,
" is no longer aboard this demonstration game.~";
"~", (name) noun, " is in ", (name) parent(noun), ".~";
default: "The computer's only really good for locating the crew.";
],
and the grammar simply returns 'stc,' which is defined as
[ Crew i;
switch(scope_stage)
{ 1: rfalse;
2: objectloop (i has crewmember) PlaceInScope(i); rtrue;
}
];
Verb "stc," * "where" "is" scope=Crew -> Examine;
An interesting point is that the scope routine doesn't need to do anything
at stage 3 (usually used for printing out errors) because the normal
error-message printing system is never reached. Something like "computer,
where is Comminder Doto'' causes a ##NotUnderstood order.
|