Newsgroups: rec.arts.int-fiction
Path: news.duke.edu!newsgate.duke.edu!nntp-out.monmouth.com!newspeer.monmouth.com!jfk3-feed1.news.digex.net!dca6-feed2.news.digex.net!intermedia!newsfeed1.cidera.com!Cidera!portc03.blue.aol.com!uunet!dca.uu.net!ash.uu.net!world!not-for-mail
From: buzzard@TheWorld.com (Sean T Barrett)
Subject: Re: [Inform] Auto-closing door help...
Sender: news@world.std.com (Mr Usenet Himself)
Message-ID: <Gq8BpB.HG6@world.std.com>
Date: Sun, 20 Jan 2002 09:00:46 GMT
References: <a2ct7q$vobp2$1@ID-26593.news.dfncis.de> <20020119181649.26637.00001625@mb-fu.news.cs.com> <a2ddsc$oc$1@ddawson.ddawson>
Nntp-Posting-Host: shell01.theworld.com
Organization: The World Public Access UNIX, Brookline, MA
X-Newsreader: trn 4.0-test72 (19 April 1999)
Lines: 51
Xref: news.duke.edu rec.arts.int-fiction:97563

Daniel Dawson <ddawson@nospam-altavista.net> wrote:
>Object  gdoor "glass door"
>...
>        time_out
>        [;
>            give self ~open;
>            if (player in location)
>                "The glass door closes.";   ! (or whatever)
>        ],

This solution looks pretty good, except for the bug
which F.R has already pointed out--location IS the
room the player's in, so 'player in location' means
"if the player is not in an enterable, and the current
room isn't dark"; you presumably meant

         time_out
         [;
             give self ~open;
             if (IndirectlyContains(location, self))
                 "The glass door closes.";   ! (or whatever)
         ],

Presumably scope-testing will be better behaved about players
trapped in closed enterables.

However, one thing I would alter about the overall design
is the use of StopTimer. As you've written it, it requires
finding EVERY place where you close the door and calling
StopTimer; for instance, if an NPC can close the door. Some
authors say "but I know I don't have anything like that in
my game"; my preference is that if there is a just-as-easy
solution that's more robust, always implement that, since
many things will change and be added over the lifetime of
the game; it allows you as author to stop worrying about
keeping track of those exact pairwise interactions.

Hence I would either add a "close this door" function that
also clears the timer, or I would just chuck the StopTimer
call and change the above to:

         time_out
         [;
             if (self has open) {
                give self ~open;
                if (IndirectlyContains(location, self))
                     "The glass door closes.";   ! (or whatever)
             }
         ],

SeanB
