Re: "at the table" not "in"


10 Jun 95 17:53:44

tim.middleton@canrem.com (Tim Middleton) wrote:

> If one declares an enterable object to be a container then when the player
> is in it the message "(in the object)" is given beside the location's short
> name. If it's a supporter then you get "(on the object)"... but how can you
> make Inform give you an "(at the object)" message.

If you are using release 5/8 or later of the Inform Library, it should
actually be quite simple. Look under item 58 in the changes.txt file to
see what it has to say about modifying standard messages.

I wrote up a short "game" to test the theory. Note that since I'm not
very used to programming Inform, I might have made some absolutely
horrible beginner's mistakes, but I hope it illustrates the idea well
enough.

Also note that I couldn't find any way to customize the message when
leaving the table properly, since the library doesn't set the 'lm_o'
variable in that case (hi Graham! :-), and the 'after' routine seems
to be run in 'location', ie the dining room, rather than in the table
itself, if I read the code correctly.

Torbj|rn Andersson

--- [ Cut Here ] ---

Switches xdv5;

Constant Story "DINNER TIME";

Constant Headline "^A Barely Interactive Example^Requires release 5/8 or \
later of the Inform Library^";

Include "Parser";

Object LibraryMessages "lm"
with before
[; ! print "[", sw__var, ",", lm_n, ","; PrintShortName(lm_o); print "]";
Look: if (lm_n == 1 && player in table) {
print "at";
rtrue;
}
Enter: if (lm_n == 1) {
if (lm_o == table)
"But you are already at the table.";
rfalse;
}
if (lm_n == 5) {
if (lm_o == table)
"You sit down at the table.";
rfalse;
}

! Exit: if (lm_n == 3 && lm_o == table)
! "You rise from the table.";
];

Include "VerbLib";

Object Dining_Room "Dining Room"
with description
"The dining room is sparsely furnished, to say the least.",
has light;

Nearby chair "chair"
with name "chair",
has supporter enterable;

Nearby table "table"
with name "table",
has supporter enterable static;

Object food "some food" table
with name "food"
has edible;

[ Initialise;
location = Dining_Room;

print "^^^Welcome to ...^^";
];

Include "Grammar";

Extend "sit"
* "at" noun -> Enter;

end;