Contents of closed, opaque, unopenable containers are examinable?

Hi, I just tried examining the contents of a closed, opaque, unopenable container and was surprised that it worked! (Standard library version 0.44.)

Here is the environment:

#player
(current player *)
(* is #in #room)

#room
(room *)

#box
(name *)
        mystery box
(descr *)
        A mysterious box.
(container *)
(closed *)
(opaque *)
(* is #in #room)
(appearance *)
        A mystery box is here. It is (if) (opaque *) (then) opaque (else) transparent (endif).

#contents
(name *)
        contents you shouldn't know about
(descr *)
        You should never see this.
(* is #in #box)

And the behavior:

A mystery box is here. It is opaque.

> open box
The mystery box doesn't open.

> examine contents you shouldn't know about
You should never see this.

My understanding was the (opaque $) predicate was supposed to prevent things like this? Is it broken or am I doing something wrong?

1 Like

Your box container is defined as an always open box because (closed *) is not part of the standard library. You want (* is closed). However the box cannot then be opened. If you make the box (openable *) it can then be opened or closed, and, it appears, by default openable containers are closed.

3 Likes

Oh, I’m embarrassed that I didn’t catch that, thank you for answering!

1 Like