Differentiating from more than one thing

With my old unworking code, I could not get a dark room by blowing out the lanterns.–as you said.

I think the principle is that I was trying to make a light room dark, but Inform prefers that I start with a dark room and illuminate it.

1 Like

Could you run your game and enter

showme enbalming room

at the command prompt and tell us what it says?

If I blow out all the lanterns, and candle stays unlit, then I get a darkroom. I attribute that to the statements in Carrying out Blowing Out.

Right, it says the room is “lighted”, which means “has its own illumination independent of other objects in the game”. You don’t want that, because you want its illumination to come from the lamps.

You can fix this by saying “the Embalming Room is a dark room”, which means it does not have its own independent illumination, and needs to rely on the lamps.

1 Like

This is exactly correct. You’ll notice that the showme output includes that the room is lighted. If you assert that it is dark, for instance by saying The Enbalming Room is a dark room. instead of The Enbalming Room is a room., you should get the results you want.

1 Like

Thx. I’ll give that a try. It means reversing some logic, but…oh well. :wink:

Arggh! That does not work. Dark room does not get lit by having three lit lanterns in it.
Inform doesn’t really know what ‘lit’ means, does it?

It does, but it uses a very narrow definition. (Things that are light sources.)

“Lighted” has an equally narrow but different definition. (Rooms that inherently provide light inside – that is, rooms which are inward-directed light sources.)

This thread has been going on for a while but I feel like it hasn’t really drilled down to exactly what you want to do.

2 Likes

Peter’s example works. Without seeing the code I can’t be sure, but I think there’s a chance your code might have worked if you had just added dark to the assertion that created The Enbalming Room, but if you added dark and “reversed some logic”, the latter may have prevented the former from yielding the desired behavior.

It’s hard to make absolute statements about anything in Inform’s world model, because Inform’s whole paradigm is that everything can be overridden. So author-created rules could create exceptions to what I’m about to say. And to keep things simple I’ll omit mentioning over and over the exceptions that stem from closed opaque containers blocking light. So, those things said:

If a player is in a lighted room, they will always be able to see, whether or not there are any lit items present.

If you want it to be the case that whether the player is in darkness in a given room is dependent on whether a lit item is present, Inform has a standard straightforward way to do that. You make the room dark. And… that’s it. If the player is in a dark room, they may or may not be in darkness. If no lit item is in sight, they’re in darkness. If a lit item is in sight, they’re not in darkness.

It is possible and sometimes useful to switch a room from lighted to dark or vice versa, for instance to implement the effect of pushing a fixed in place light switch. But if you want whether the player is in darkness to depend on whether a lit thing is present, leave the room as dark throughout and implement ways to change things from lit to unlit.

I keep saying in darkness as opposed to in a dark room because in darkness is the conditional phrase that tests whether the player has light to see by and in a dark room, as described above, doesn’t tell us whether the player has light to see by, it just tells us that they wouldn’t have light to see by unless they could see a lit thing.

If the above doesn’t help, please try boiling your code down to a minimal example and sharing it again.

2 Likes

Andrew,
Thank you for taking all this time for my problem. I will run some final tests and put my source code into a
file and send it to you. Probably there is a better way to do what I do.
-abc

Good moms let you lick the beaters. Great moms turn them off first.

Andrew,
I think this file works as I want now.

Player enters the Embalming Room where a flammable poisonous gas leaks from a green canister. At least one burning lantern will consume the gas so the player may explore safely. Players are warned not to extinguish the lanterns. Of course, the contrarians will do exactly that. They will suffocate after three turns–end of story.

The second purpose of the burning lantern is to allow the player to light their candle, which is needed elsewhere. If the candle is lit, the player is still safe if they don’t leave the room with the lanterns off. Entering the gas-filled room with a lit candle will cause an explosion–end of story.

Attached is a file of the source.
It is not particularly long, but I would appreciate any improvements or efficiencies, if you see that.
-Falsoon2

Exploding Room.txt (8.17 KB)