Room out of scope while in container

I’ve made a transparent open container that the player can step into. When she steps in, I want her to be able to see the things in the room but not touch them. I tested, and by default she can see and touch things in the room.

This didn’t work:

After deciding the scope of the player: if the player is enclosed by the decanter place the dressing room out of scope.

Nor did a host of other variations, including “rule for deciding the scope of the player” in which I avoided using “out of” by explicitly defining the scope when one is in and out of the container.

I read the whole chapter in the documentation on scope, but it only shows how to put new things in scope.

Maybe scope isn’t even the right approach here.

I’m guessing that by “see things”, you mean you want the player to be able to EXAMINE things outside of the container, correct? Because if the container is transparent, she can already see outside of it by default. There’s no need for scope at all, because if it’s transparent, things that are outside the container are already in scope. However, the player is blocked by doing anything with them, including examining, by the “can’t reach outside closed containers rule”.

So, if you want the player to be able to examine objects outside of the container, but not do anything else with them, then something like this should work for you.

[code]A reaching outside rule when the player is in the decanter and the current action is examining:
allow access;

A reaching outside rule when the player is in the decanter and the current action is searching and the noun is a container:
say “You can’t see into [the noun] from here.”;
deny access;

A reaching outside rule when the player is in the decanter:
say “You can’t reach through the glass.”;
deny access.[/code]

The first rule allows access for examining. The subsequent rules show how you can make the output more appropriate to the particular situation.

–Erik

Thanks Erik. That worked.

Instead of smelling when the player is in the decanter: say "Smells delightful."

Why doesn’t my code override the other response?

Thanks!

The reaching outside rules take effect before the action rules. That’s why I included examples of how to customize action responses using the reaching outside rules in my last post. Here’s how you would do your smelling response using the same method I showed before:

A reaching outside rule when the player is in the decanter and the current action is smelling: say "Smells delightful."; deny access.

Another option would be to disable the “can’t reach outside closed containers rule” entirely; you could then write instead rules for actions as you’ve tried to do with smelling. You’d have to be sure you covered all actions, though, or the behavior will be buggy (without the can’t reach outside closed containers rule, the player will be permitted to do just about anything with the objects outside the container.)

–Erik

Oh, sorry – I failed to extrapolate your examples to the smelling action.

Thanks!!!

Ok, more troubles. It seems that seeing/examining is not in scope after all, or at least not after writing these rules.

[code]A reaching outside rule when the player is in the decanter and the current action is smelling:
say “Smells delightful.”;
deny access.

A reaching outside rule when the player is in the decanter and the current action is examining:
allow access.

A reaching outside rule when the player is in the decanter and the current action is not smelling or examining:
say “You can’t reach anything in the room while trapped in the jar.”;
deny access.[/code]

I tried leaving the middle command out since it’s redundant, and rearranging the syntax a few ways, but it isn’t working:

I also tried changing the syntax of the middle block to:

A reaching outside rule when the player is in the decanter and the current action is examining: say "test".

And as one might guess I never saw the word “test”.

I’m sure I just need a minor tweak, but I can’t seem to figure out what it is.

Thanks again for all your help, Erik.

The drawer is probably a container for which you have not written a description, correct? Inform silently forwards the examining action to the searching action when you are looking at a container that is undescribed; in other words, when you EXAMINE a container that doesn’t have its own description, you’re actually SEARCHing. (This will change in the next build, according a post Emily Short left in a recent thread here.) For now, use this rule:

A reaching outside rule when the player is in the decanter and the current action is searching and the noun is a container: allow access.

By the way, I just tested this stuff in Inform, and the rule about examining actually isn’t needed at all, so you were right to get rid of it. In fact, it looks like examining is allowed from within a transparent container by default, which leaves me puzzled about what occasioned your initial post–perhaps smelling or some other action?. Anyway, this means that you can also remove the reference to examining from your third rule.

By the way, the third rule also isn’t working as you intend. I’m actually a bit surprised that Inform allows it to compile. Anyway, it would be good practice to get in the habit of writing the full condition for each element when you have multiple conditions. So, this:

A reaching outside rule when the player is in the decanter and the current action is not smelling and the current action is not examining:

instead of this:

A reaching outside rule when the player is in the decanter and the current action is not smelling or examining:

Again, though, in this case you don’t need to mention examining in this rule. It already is allowed by default.

–Erik

Oh jeez. I knew that, I just didn’t think of it in terms of this puzzle.

My room has very few items thus far, so I just picked the drawer to examine to test how it was working and then assumed it wasn’t. But you are correct, when I examine a non-container I can see it just fine, with or without that redundant rule.

Thanks again Erik.