Newsgroups: rec.arts.int-fiction
Path: nntp.gmd.de!newsserver.jvnc.net!newsserver2.jvnc.net!cpk-news-hub1.bbnplanet.com!news.bbnplanet.com!cam-news-hub1.bbnplanet.com!howland.erols.net!netcom.com!erkyrath
From: erkyrath@netcom.com (Andrew Plotkin)
Subject: Re: [Inform] found_in bug?
Message-ID: <erkyrathE1ErAr.MGA@netcom.com>
Organization: NETCOM On-line Communication Services (408 261-4700 guest)
X-Newsreader: TIN [version 1.2 PL1]
References: <32990308@beachyhd.demon.co.uk>
Date: Mon, 25 Nov 1996 04:04:02 GMT
Lines: 50
Sender: erkyrath@netcom22.netcom.com

Adam@beachyhd.demon.co.uk wrote:
> Hi all,

> I have a number of rooms, each of which I want to be lit by a light attached to
> the wall. These lights can all be switched on or off centrally by a single
> switch.

> To save me having to create a number of light objects, I created just one (with
> the "light" property) and used found_in to put this light in to all the
> relavent locations.

> However, this doesn't behave how it should. I'm also carrying a portable light
> source (an oil lamp) and using the two I'm able to reproduce the effect..

[...]

> Is this an Inform bug?

Sadly, yes. Or, not so much a bug, as something the library just can't 
handle. If you look at the PlayerTo function, which is what all player 
movement eventually boils down to, you'll note that it calls 
AdjustLight() before it calls NoteArrival() or <Look>. The 
MoveFloatingObjects() function gets called from NoteArrival() (or by 
LookSub(), which calls NoteArrival().) So light is figured out before 
floating objects move. 

Later in the turn cycle, I believe AdjustLight() gets called again, but 
it's too late -- the initial <Look> has already happened.

No floating lights in Inform. :-(

If you want to make this work, you could try to fix the library. This 
prospect frightens me. Movement is an old and convoluted part of the 
library; ditto for floating objects.

I would make a lot of separate light objects. In Inform 6, you could use

  objectloop (obj ofclass LightClass) {
    give obj light;
  }

to hit all the objects. In Inform 5, just have an array containing all 
the lights in the game, and run through it with a for loop.

--Z

-- 

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