Newsgroups: rec.arts.int-fiction
Path: nntp.gmd.de!news.ruhr-uni-bochum.de!news.uni-stuttgart.de!uni-regensburg.de!lrz-muenchen.de!informatik.tu-muenchen.de!Germany.EU.net!Frankfurt.Germany.EU.net!news.maz.net!ins.net!blackbush.xlink.net!howland.reston.ans.net!math.ohio-state.edu!uwm.edu!uwvax!uchinews!kjfair
From: kjfair@midway.uchicago.edu (Kenneth Fair)
Subject: Re: [Inform] Object description question
X-Nntp-Posting-Host: ngrh-34.rh.uchicago.edu
X-Kook-Number-2: 14
Message-ID: <kjfair-0804962253140001@uchinews.uchicago.edu>
X-Kook-Code-2: (Grubor+++)*2 Boursy+ Palmer+++++++
Sender: news@midway.uchicago.edu (News Administrator)
Organization: University of Chicago School of Law
X-Newsreader: Yet Another NewsWatcher 2.2.0b6
References: <4kbi8j$4qu@black.clarku.edu>
Date: Tue, 9 Apr 1996 03:53:14 GMT
Lines: 86

In article <4kbi8j$4qu@black.clarku.edu>, forispaa@black.clarku.edu (The
Ur-Grue) wrote:

>I'm finally learning Inform! Thanks to those who helped me fix the
>compiling problem. Anyway, a small query:
>I have an object, which has a certain description. once taken and
>dropped, it has a different description. However, if picked
>up again, I would like it to return to the original description.
>
>For now it's like this (written in completely incorrect format for
>laziness' sake)
>
>object "box"  
>describe
>if (box has moved)
>"a box rests by your feet";
>"thre's a box on the table";
>descrioption "a small box on a table"
>after
>drop: box.description="the box rests by your feet"
>"the box rests by your feet" 
>
>the problem here is that if you pick up the box again, and look at it,
>it says 'the box rests by your feet'. how could i fix that?
>is there some way to:
>if (box is on the floor) "blah blah"
>    (box is on self) "blah blah"
>        "blah blah"
>???
>
>please respond by email

(posted and mailed)

I'm going to make a stab at it here, just for my own edification.  That
way, if my newbie cluelessness strikes, others can warn me off the path
of danger.

I would assume that one easy way to do this would be by asking about the
parent of the box object.  So you could have:

describe [;
   if (parent(box) == player) { "blah blah player spam."; }
   if (parent(box) == table) { "spam blah table spam spam"; }
],

I believe that perhaps part of what you want to do can come from the 
supporter objects.  For example, in the landscape I'm working on, I have
a concrete bench.  I've included the concrete bench in the definition of
the room, like so:

Object   knoll "Grassy Knoll"
   with  description "Although this is not the most famous grassy knoll in \
            Texas, it is one of the more pleasant.  Low concrete benches \
            rest under shady oaks, while squirrels and birds cavort about.",
         e_to butcher,
         se_to bhsteps;

Nearby   bench "concrete bench"
   has   static enterable scenery supporter,
   with  name "concrete" "bench",
         description "Three concrete arches support a thicker concrete slab, \
            combining to form a pleasingly benchy package.";

The "scenery" attribute makes the bench invisible when you look around the
room, but "x bench" will return the bench description.  Furthermore, you
can sit on the bench and the room description will say "(on the bench)".
Also, if you put something on the bench, the room description will change
to say, "You see a backpack sitting on the concrete bench."

So your best bet, IMHO, would be to define a static supporter scenery table
object, define box like:

   Object   box "cardboard box" table

so that it is a child of the table object, and not worry about mucking about
with describe.  The default library messages will probably take care of the
rest of your needs.

Ken

--
KEN FAIR - U. Chicago Law  | Power Mac! | Net since '90 | Net.cop
kjfair@midway.uchicago.edu | CABAL(tm) Member | I'm w/in McQ - R U?
  "I'm sorry to have written such a long letter.  I did not have 
   time to write a short one."    - George Bernard Shaw
