Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

I7: Description from inside

1 view
Skip to first unread message

peterb...@mac.com

unread,
Dec 27, 2006, 8:12:06 AM12/27/06
to
So, while I can puzzle out how to do an awful lot more in Inform 7
(wonderful toy that it is) than I could of Inform 6, I've run across a
kind of specific problem that I can't seem to solve. Any help would be
much appreciated.

In my project, there's a circumstance where the player can hide inside
a container, which is then picked up and carried to another location by
an NPC. This part works great. The problem is when that NPC (call him
"Bob") is carrying something else at the same time. In that case,
looking from inside the container while Bob is carrying it gives a room
description something like:

<imaginary game text>

Long Road To Nowhere (in the container) (in Bob)
The road stretches ever onward.

You can see a thingummy, a widget, and Bob here.

In Bob you can see a pocketwatch.

</imaginary game text>

Not exactly elegant. What I want to do is change "In Bob you can
see..." into "Bob is also carrying...", but I can't figure out how to
do that with the description from inside a container. I suspect it has
something to do with the listing nondescript items activity, but what?

Any thoughts?

Mike

Emily Short

unread,
Dec 27, 2006, 1:38:30 PM12/27/06
to

peterb...@mac.com wrote:
> What I want to do is change "In Bob you can
> see..." into "Bob is also carrying...", but I can't figure out how to
> do that with the description from inside a container. I suspect it has
> something to do with the listing nondescript items activity, but what?
>
> Any thoughts?

This appears to work:

<code>
The Big Bird House is a room.

Bob is in the House. The player is in a birdcage. The birdcage is
carried by Bob. Bob carries an electric torch. The torch is lit.

Rule for listing nondescript items of a person when the player is
enclosed by a person (called giant):
say "[The giant] is also carrying [a list of marked for listing things
which are carried by the giant]."
</code>

In the above rule, "of a person..." restricts it so that this rule will
only occur when listing things carried by someone; "when the player is
enclosed by..." means to use this rule only when the player is directly
or indirectly carried by that person. (If we just had "when the player
is carried by...", that would not catch the case of the player being in
the cage carried by Bob.)

ChicagoDave

unread,
Dec 27, 2006, 2:24:14 PM12/27/06
to
> Emily Short wrote:
> peterb...@mac.com wrote:
> > What I want to do is change "In Bob you can
> > see..." into "Bob is also carrying...", but I can't figure out how to
> > do that with the description from inside a container. I suspect it has
> > something to do with the listing nondescript items activity, but what?
> >
> > Any thoughts?
>
> This appears to work:
>
> <code>
> The Big Bird House is a room.
>
> Bob is in the House. The player is in a birdcage. The birdcage is
> carried by Bob. Bob carries an electric torch. The torch is lit.
>
> Rule for listing nondescript items of a person when the player is
> enclosed by a person (called giant):
> say "[The giant] is also carrying [a list of marked for listing things
> which are carried by the giant]."
> </code>
>

See here. This is why Inform 7 rocks.

This would be a nightmare in Inform 6.

David C.

peterb...@mac.com

unread,
Dec 27, 2006, 3:20:54 PM12/27/06
to
>Emily Short wrote:
> Rule for listing nondescript items of a person when the player is
> enclosed by a person (called giant):
> say "[The giant] is also carrying [a list of marked for listing things
> which are carried by the giant]."

Thank you! This works beautifully.

A related question which occurred to me about 30 seconds after posting
last time, and which is hopefully just as easy to solve: After the room
description the parenthetical comments "(in the birdcage) (in Bob)" are
tacked on. Is there a way to change the "(in Bob)" to read something
like "(carried by Bob)"? It's not clear to me which activity is
generating those messages.

Thanks again. I'm having an awful lot of fun playing with this.

Mike

Khelwood

unread,
Dec 27, 2006, 3:21:01 PM12/27/06
to

Hardly a nightmare. LibraryMessages is your friend.

Emily Short

unread,
Dec 27, 2006, 3:56:18 PM12/27/06
to

No activity, but that doesn't mean you can't change it. You have two
options here.

One is to change the library message for this situation using an
extension such as David Fisher's Default Messages. (Download here:
http://www.inform-fiction.org/I7/Download%20-%20Extensions.html .) I
can get the results you want with the following:

<code>
Include Default Messages by David Fisher.

The Big Bird House is a room.

Bob is in the House. The player is in a birdcage. The birdcage is
carried by Bob. Bob carries an electric torch. The torch is lit.

Rule for listing nondescript items of a person when the player is


enclosed by a person (called giant):
say "[The giant] is also carrying [a list of marked for listing things
which are carried by the giant]."

When play begins:
set LibMsg <top line what in> to " [if main object is a
person](carried by [the main object])[otherwise](in [the main
object])[end if]".
</code>

This approach is appropriate if you only want to change that one aspect
of the way room headings are displayed, and/or you anticipate wanting
to modify a bunch of other messages. (You could also use Default
Messages to change the listing nondescript results, if you wanted.)

The other option, appropriate if you want to assert more general
control over room headings, would be to find the rule that prints these
headings and replace it. In this case, the rule in question is a Carry
out looking rule, specifically the "room description heading rule".
(You can find these by looking in the Actions tab of the index and
seeing the sequence of rules followed for a given action.)

To override this, you might write

<code>
The Big Bird House is a room.

Bob is in the House. The player is in a birdcage. The birdcage is
carried by Bob. Bob carries an electric torch. The torch is lit.

Rule for listing nondescript items of a person when the player is


enclosed by a person (called giant):
say "[The giant] is also carrying [a list of marked for listing things
which are carried by the giant]."

The new room description heading rule is listed instead of the room
description heading rule in the carry out looking rulebook.

This is the new room description heading rule:
if the location is not a room, rule succeeds;
say "[bold type][location][roman type]";
let the current-container be the holder of the player;
while the current-container is not the location
begin;
say " ([if current-container is a person]carried by[otherwise if
current-container is a supporter]on[otherwise]in[end if] [the
current-container])";
let current-container be the holder of current-container;
end while;
say line break.
</code>

This new room description heading rule mostly mimics the default
behavior of the library, but you could also rewrite it, if you liked,
to create room headings that looked very different (like "Carried by
Bob in Big Bird House", for instance, if you wanted) or to define a new
activity of your own. (See the Crusoe example for how to introduce new
activities into various places in the standard library.)

The basic philosophy here is that Inform pre-defines activities where
it would be hard for the author to add his own, but that the author is
free also to add hooks as needed elsewhere in the standard library by
manipulating the rulebooks.

peterb...@mac.com

unread,
Dec 27, 2006, 4:46:07 PM12/27/06
to
Hmm. Default Messages seems to have done the trick, although I'll have
to sit down and puzzle over exactly how this works, in case I need to
do something similar in the future. It looks like a powerful extension.

Thanks for your help, Emily. I appreciate your taking the time to point
me in the right direction.

Mike

r...@culturalwilderness.com

unread,
Dec 28, 2006, 2:44:55 PM12/28/06
to
Emily Short wrote:
>
> The other option, appropriate if you want to assert more general
> control over room headings, would be to find the rule that prints these
> headings and replace it. In this case, the rule in question is a Carry
> out looking rule, specifically the "room description heading rule".
> (You can find these by looking in the Actions tab of the index and
> seeing the sequence of rules followed for a given action.)
>

I've done most of the work of replacing the room description heading
rule (and the subsequent room description body text rule) in my as yet
unreleased Room Headline Control extension. It needs a couple of
updates based on the latest procedural rule / listed instead changes
and there's a couple of odd paragraph break bugs I haven't squashed
yet, but a pre-release version sits at:
http://www.culturalwilderness.com/development/Room%20Headline%20Control
for general perusal.

The theory is, needing to replace the "(in Bob)" text after the room
title, you'd instead write:
A player location rule for Bob:
say "(nestled comfortably in the palm of Bob's hand) ".

Regards
Rob

0 new messages