Re: Another Darkness question


13 Nov 1995 19:31:57 GMT

Chris Malone <00ctmalone@bsuvc.bsu.edu> wrote:
> The game I have in mind requires a little footwork when it comes to
> light. As I see it know, I want light to be dealt with in 3 states:
> 1) normal darkness, player can't move or take stuff. This is taken
> care of my the DarktoDark routine, and is no problem. Now it gets
> trickier: 2) The player has a book of matches to light his/her way
> around while trying to restore the normal house-lights (they've been
> blown out by a storm). The player should be able to maneuver around,
> but room descriptions are changed, and certain objects are
> unnoticeable. Lastly 3) is the normal lighted state, in which all
> objects are noticeable and normal room descriptions are given.

A tricky problem. The approach that springs to mind first is this:

* Have a global variable called `light_state' that is 0 in darkness, 1
in dim light and 2 in full light.

* Give your burning match the `light' attribute as usual.

* Write room descriptions that look at `light_state' to decide whether
or not to print some sentences.

* You can make an object appear in a room description in full light
and not in dim light using `describe' code like:

Object Painting "painting"
has static
with describe [;
if (light_state == 1) rtrue;
"^A painting hangs on the south wall.";
],
...

* Write a TimePasses() routine that sets the variable `light_state'.
It can look at the Inform global variable `lightflag', but it will
also have to do some work to decide what kind of light source is
present. Look at the routines `OffersLight' and `HasLightSource' in
the library file parser.h for a guide as to how to do this kind of
thing.

Post here again if you still have trouble.

-- 
Gareth Rees