Frustration (preventing reachability from a supporter)

I have ‘finished’ a game, but one thing I never ever checked about it–whether the player was allowed to do certain things while ‘on’ or ‘in’ something. I thought it was just a matter of common sense. I thought that the program would naturally not allow the player to do things with scenery objects while the player was ‘on’ or ‘in’ another scenery object–unless that object was also there. For example, in a bedroom, the player would be on the bed, and there is a closet, a desk and a piano. I did not expect to be able to open the closet, play the piano or open the desk while sitting or laying on the bed. Or to be able to take something off the floor. Is there a way that I can prevent these activities–while permitting others(and many others)–without having to write an extensive list of actions that are/are not allowed while on the bed? Or having to write a check rule for each of these?

Thanks.

Check out the documentation 12.18. Changing reachability.

[code]“Reaching”

Test Room is a room.

Furniture is a kind of supporter. Furniture is enterable.

The seat of sloth is furniture in Test Room.

A handy floor lamp is a device in test room.

A rule for reaching outside furniture:
if the person reaching is the player:
say “You’ll need to get your lazy duff off [the supporter in question] first.”;
deny access.

Test me with “turn on lamp/sit on seat/turn off lamp”.[/code]

Thanks Hanon,
I must have forgotten that one, it’s been months since I read that part. I discovered my problem while I was working on my new game, luckily I haven’t been very far into it yet. I am going to have to go over my other game entirely with that concept. I tried your solution and it works. There is a string that hangs over the bed, so I can turn on the ceiling fan–I was able to make an allowance for it(ie ‘If the noun is not the hanging string:…’). However I notice that a verb that I created – ‘playing’(for the piano)–is still allowed. How do I alter this action so it won’t be allowed by a reachability rule??

Thanks

Modify your “playing” verb to require the noun to be touchable:

Playing is an action applying to one touchable thing.

And I believe the reachability rules will affect it.

You may also wish to append

Playing is an action applying to one touchable thing and requiring light.

If you don’t want it to work in the dark.

thanks–does touchability include visibility?

okay I did have the ‘requiring light’ phrase. thanks

“Visibility” is a weirder thing that often doesn’t work the way people expect it to. If I recall correctly, it means “in scope” which might not line up with what the general definition of “visible” means in real life. Often it’s easy enough to just make an action require light (see my edited message above.)

Otherwise see 12.17. Visible vs touchable vs carried, and 12.19. Changing visibility.

[IGNORE ALL THIS and see post below, I have it wrong here]

Touchability does not require light - I believe you can take something in a dark room but you can’t examine it and the parser won’t tell you it’s there.

Touchability does require visibility, which means it’s in scope, which is where confusion happens because (I hope I have this right) the parser will call something visible and in-scope, even though the player can’t see it because the room is dark. Hopefully someone can explain this better if I’ve got it wrong.

Apologies, I’m wrong - darkness precludes touchability. However, you can manually move things around. I remember now learning how to do this in Transparent which played with a lot of annoying darkness to allow people to find a light switch in a dark room.

[code]“Reaching”

Test Room is a dark room.

Furniture is a kind of supporter. Furniture is enterable.

The seat of sloth is furniture in Test Room.

A handy floor lamp is a device in test room. It is lit. it is switched on.

Carry out switching on floor lamp:
now floor lamp is lit.

Carry out switching off floor lamp:
now floor lamp is not lit.

After deciding the scope of the player:
if in darkness:
if floor lamp is in the location:
place floor lamp in scope.

A rule for reaching outside furniture:
if the person reaching is the player:
say “You’ll need to get your lazy duff off [the supporter in question] first.”;
deny access.

Test me with “scope/turn off lamp/scope/sit in seat/turn on lamp”.[/code]

Technically I think the way it works is that, when in darkness, by default the only things in scope are the things you enclose (and thus they are the only things you can interact with). So:

Cave is a dark room. A rock is in Cave. The player carries a broom. A stick is part of the broom. The player wears a coat. A nose is part of the player.

The standard touching action applies to one touchable thing (naturally) and doesn’t require light, so:

In fact this works even if you define an action as applying to “one visible thing,” as long as you don’t define it as “requiring light”:

[code]Cave is a dark room. A rock is in Cave. The player carries a broom. A stick is part of the broom. The player wears a coat. A nose is part of the player.

Scanning is an action applying to one visible thing. Understand “scan [something]” as scanning.

Report scanning: say “You focus your mental energy on [the noun] but don’t accomplish anything.”[/code]

So basically, as I understand it:
if an action applies to “one visible thing” you can do it to anything in scope.
…unless it’s defined as “requiring light,” in which case you can’t do it in darkness. Basically, “visible thing” means “anything in scope.” (And darkness takes most things out of scope.)
If an action applies to one touchable thing then not only does the noun have to be in scope–or the command won’t even be understood–but the action will consult the reachability rules.
Also, if you just write “applying to one thing” Inform automatically assume you mean one touchable thing.

If you have several different actions that don’t actually require a noun but that the player can’t do when on the bed, you can use a kind of action to wrap them all up in one rule–see §7.15. You do have to write a list of things that fall under that kind of action though.

Thank you both!