Differentiating from more than one thing

I am using Ver 10 on Windows (not that Windows/Mac would make any difference to this).

Have you tried just pasting my room into a blank project?

drbates:
Sorry for the delay in response. I was pre-empted by another project. I would like to move forward on this now. I want to paste your code into a blank project and see what happens. What is that code? Can you post (or email) it again?

"Embalming_Room" by PB


The Embalming Room is a dark room.  "Lanterns flicker smokily,  sending shadows leaping in the darker recessses of this square chamber.". The reliquary is north of the Embalming room. The Antechamber is east.  The reliquary is dark.
A lantern is a kind of thing with description "A glass-enclosed wick on a metal reservoir of some kind. On the reservoir is a hand-written note in large block letters: [line break]DANGER: DO NOT EXTINGUISH.[line break][if lit]A flame flickers within the glass[else]The charred wick sheds no light."."[if lit]A lantern shines on a cabinet along the [word number one in printed name] wall.[else][The item described] sits in darkness.".

The south lantern, the north lantern and the west lantern are lit lanterns in the Embalming Room.

Rule for printing the description of a dark room when the location is the embalming room:
	say "Pressed in on all sides by Stygian blackness, you fancy you can faintly hear the soft scuttling and chittering of ten thousand nameless horrors...";
	if the torch is carried:
		say "You grope frantically for your torch.".

Rule for printing the description of a dark room when the location is the reliquary:
	say "In pitch darkness, you can hear the soft scuffling of ten thousand unimaginable horrors.".

Blowing out is an action applying to one thing.
Understand "blow out [something]" or "extinguish [something]" or "put out [something]" as blowing out. 

Check blowing out an unlit thing:
	say "[We] can only put out things which are lit." instead.
Carry out blowing out:
	now the noun is unlit.
Report blowing out:
	say "[We] [put] out [the noun][if the noun is a lantern]. A small thread of smoke rises as the wick cools[end if].".

Test me with "blow out north/blow out west/blow out south/look".

The player carries the torch.

[Definition: A room is dark if all lanterns are unlit.]

[Instead of looking when embalming room is dark:
	say "Without the lanterns, it is too dark to see anything. [line break]Do you smell something?".]

PB:
I ran your code and everything seemed to work as expected. I need to examine the differencesā€“and expand for a candle, which can be lit from the lanterns, or vice versa.
Attached is a picture of your code results.

PB: I cannot get the room to get dark. Inform does not automatically set the room to dark when all lanterns are unlit. Your code did not do it either. I added that controversial Definition and it worked. I limited its scope by saying:

Definition: Embalming Room is dark is all lanterns are unlit.

Any suggestions?

Peterā€™s code works in both 10.1 and 6M62. Whatever is happening for you comes from doing something different. The most obvious possibility is that the room isnā€™t dark. Lighted/dark is a built-in either/or property on rooms. It refers to whether the room is inherently lighted or not, not to whether the room is in darkness in the moment. Despite being in a dark room*, a player is not in darkness and can see if they have unobstructed line of sight to a lit thing. (A lit thing thatā€™s in a closed opaque container that the player isnā€™t also inside isnā€™t a help.) So when you created the room, did you say: The Embalming Room is a dark room.? Comment out your definition and try it with that.

(Iā€™m not saying anything Peter didnā€™t already say; the above is just for review.)

* (or unlit closed opaque enterable container)

1 Like

Zed:
Exactly. I commented out the definition, and the darkness effect does not work. Looking gives the exact same thing whether light or dark. SHOWME room does not say the room is dark when all lanterns are unlit.

On a related note: Can I make a property for the room so that when only the candle is lit, the room is DIM? I want LOOK to describe the room slightly differently for DIM, DARK, and LIGHTED.

Did you also add asserting that the room is dark?

Thatā€™s what I am trying to do. Unlit lanterns do not automatically make the room dark. PBā€™s code made me think that the room knows when nothing is lit, the room is dark. Do I need to count the number of unlit lanterns and go from there?

When you create The Enbalming Room, does your code say The Enbalming Room is a room. or does it say The Enbalming Room is a dark room.?

The latter could also be separate statements:

The Enbalming Room is a room.
The Enbalming Room is dark.
1 Like

The Embalming Room is a room. It should be lighted until all lanterns are blown out.
Where/how do I say that the room is dark if not in the Definition? I was under the impression that when there is nothing lit in the room, Inform knows that the room is Dark.

You say: The Enbalming Room is a dark room. Again, dark has meaning thatā€™s built into the Standard Rules.

1 Like

For comparison, whatā€™s the output when you run the exact code from Dr. Peter Batesā€™ post above and enter TEST ME?

Hereā€™s what I get under Inform 7 v10.1.2:

Embalming Room
Lanterns flicker smokily, sending shadows leaping in the darker recessses of this square chamber.

A lantern shines on a cabinet along the south wall.

A lantern shines on a cabinet along the north wall.

A lantern shines on a cabinet along the west wall.

>test me
(Testing.)

>[1] blow out north
(the north lantern)
You put out the north lantern. A small thread of smoke rises as the wick cools.

>[2] blow out west
(the west lantern)
You put out the west lantern. A small thread of smoke rises as the wick cools.

>[3] blow out south
(the south lantern)
You put out the south lantern. A small thread of smoke rises as the wick cools.

It is now pitch dark in here!

>[4] look
Darkness
Pressed in on all sides by Stygian blackness, you fancy you can faintly hear the soft scuttling and chittering of ten thousand nameless horrorsā€¦
You grope frantically for your torch.

(The room is declared as dark at the beginning of Dr Batesā€™ code: The Embalming Room is a dark room.)

2 Likes

Right, But in my case, I want the room to be undark until the lanterns are blown out.
After I do that, how do I declare the room dark? I am playing with brightness values for the room at the moment for Light, Dim, and Dark.

OK. If I add this code into my Blowing out action:

Cary out blowing out:
    now the noun is unlit;
    if all lanterns are unlit and candle is unlit:
		now embalming room is dark;

I can get the room dark without the Definition.

That is the case with the given code, as far as my testing goes. When you add an item to the room, for example:

A sarcophagus is in the Embalming Room.

ā€¦ then at the beginning, while not all lanterns have been blown out, the player will see, as expected (because the room is not dark while a lit lantern is there):

You can also see a sarcophagus here.

Whereas, after all lanterns have been blown out, the player will not be able to see the sarcophagus:

Darkness
Pressed in on all sides by Stygian blackness, you fancy you can faintly hear the soft scuttling and chittering of ten thousand nameless horrorsā€¦
You grope frantically for your torch.

>x sarcophagus
You canā€™t see any such thing.

I think it would be ideal if you get that working first, and then we can think about additional lighting levels later.

What statement makes the room dark? It does not happen automatically. I always get the full description when Looking. See the post I made about the same time as yours above, when I added a couple statements to the Blowing Out action.

Do you give the player a lit candle? (It seems so from what you wrote above.)

If yes, then that explains why the room is not dark (in the sense of appearing dark to the player) even when all lanterns have been blown out: the candle still provides light.

However, when the player then enters ā€œBLOW OUT CANDLEā€, that will be enough to make the room ā€œreturnā€ to darkness (as declared at the beginning in The Embalming Room is a dark room.) automatically; even without the special addition to the Blowing Out rule. Itā€™s sufficient to write:

Carry out blowing out:
	now the noun is unlit.

No, player did not have a lit candle, but they could light a candle without a flame source (error). One lantern must be lit to light the candle.
I think this is what I needed:

Carry out blowing out:
	now the noun is unlit;
	if all lanterns are unlit and candle is unlit:
		say "DARK";
		now embalming room is unlookable;
	if all lanterns are unlit and candle is lit:
		say "DIM";
		now embalming room is dim;

Embalming room can be lookable, dim, or unlookable. (Light and Dark were already taken and gave error messages.) A dim room blocks detailed examining.

The property ā€œdarkā€ on a room means ā€œnot providing its own lightā€. It does not mean ā€œnot illuminated by any other sourceā€. So if you declare that The Embalming Room is a dark room at the top of your code, that means ā€œthe Embalming Room does not provide its own light, but can be illuminated by other things (such as the lamps)ā€.

By default, rooms are ā€œlitā€, which means ā€œproviding their own lightā€. When youā€™re in a ā€œlitā€ room, no matter what, it will always be illuminated. Other objects in the game can make a ā€œdarkā€ room be illuminated, but cannot make a ā€œlitā€ room not be illuminated.

1 Like