Newsgroups: rec.arts.int-fiction
Path: nntp.gmd.de!news.ruhr-uni-bochum.de!news.uni-stuttgart.de!rz.uni-karlsruhe.de!news.uni-kl.de!news.belwue.de!fu-berlin.de!data.ramona.vix.com!news1.digital.com!su-news-hub1.bbnplanet.com!news.bbnplanet.com!cpk-news-hub1.bbnplanet.com!www.nntp.primenet.com!nntp.primenet.com!netcom.com!erkyrath
From: erkyrath@netcom.com (Andrew Plotkin)
Subject: Re: Implementing a real cage
Message-ID: <erkyrathE0tHnw.CqA@netcom.com>
Organization: NETCOM On-line Communication Services (408 261-4700 guest)
X-Newsreader: TIN [version 1.2 PL1]
References: <56b6io$oc4@bigpapa.nothinbut.net>
Date: Wed, 13 Nov 1996 16:26:19 GMT
Lines: 63
Sender: erkyrath@netcom.netcom.com

roue (roue@bigpapa.nothinbut.net) wrote:
>  I've got a room with a box in it. In the box is some food. The player can
> enter the box, but when he does it shuts behind him and locks. 
>  
>  Problem 1. I can put the player in the box and lock it so that he can't
> get out, but I found that even from inside the locked box the player could
> interact with the other objects in the room. For example, from inside the
> box the player can still turn on and off the sink that's outside the box.
> I tried to solve this problem with scope rules but could only find ways to
> increase scope, not limit it.

I believe that's right. Mmm, well, you might be able to do it by making 
the box ~transparent, but I'm not sure of that. 

> Instead I created a before routine for
> entering the box which 
>     1. transported the box into another room identical to the first minus
> 	all the outside objects.
>     2. Playerto(Box) (so that the player is now in the box in the new room

>  Now as far as I understand it a    move box to newroom
>  should also move the food already contained in the box, but it didn't.

Yes it does. If it doesn't for you, something else is wrong.
   
>  I then added a 1.5  move food to box
>  
>  and now the food does appear in box when the player (having been moved)
> looks, but he can't eat or touch or do any of the things he could do with
> the food before. It's as though the description is there, but the food
> really isn't. 

You've done something truly magical. Do you maybe have some of the scope 
declarations still in from your last try? Do you have two food objects? 

A simpler (but not necessarily easier) solution would be to put a 
react_before on the cage, on the order of 

react_before [;
  Examine:
    rfalse;
  default:
    if (player in cage) {
      if (noun ~= nothing && noun in BigRoom)
        print_ret "You can't reach ", (the) noun, ".";
      if (second ~= nothing && second in BigRoom)
        print_ret "You can't reach ", (the) noun, ".";
    }
],

Actually this is a little buggy; it locks you away from objects that are 
in the room, but not their contents (so you could reach a fork in the 
sink.) You'd really want a AnywhereIn(obj, cage) function -- I don't know 
if such a thing made it into the Inform 6 libraries.

Also check the special case of the cage itself.

--Z

-- 

"And Aholibamah bare Jeush, and Jaalam, and Korah: these were the
borogoves..."
