Reaching a trapdoor

Hi,

I’m entirely new to Inform 7 (although I used Inform 6 in the very very very early days!), and am working with some children to write an educational game. As it unfolds I’ll be glad to share some of it!

At this stage, I’m trying to work out the best approach to a simple problem. I’ve been working through the recipe book and writing with inform book, together with the inform handbook. These are all great, but I’ve not yet come across an appropriate section to help me decide the best approach.

The scenario is simple. There’s a trapdoor which is out of reach, requiring the player to have something they can stand on in order to reach it and clamber up. I initially thought this could be done using a key, but I don’t want to see messages telling me that the trapdoor is locked. It isn’t. I just can’t reach it. So instead, I’m thinking that I should just set a requirement for a specific item to be in the room or carried in order to allow it. I also need to work out the best way to handle the various messages about failing to reach the trapdoor, and longer term I can imaging setting some properties such as height which would allow the player to use something else as a stool.

Anyway - slightly rambly first post, but I wanted to say hello, and see if there’s an obvious place to read about this, or an obvious example which does something similar, or perhaps a steer in the right direction.

Thanks in advance.

[code]Jail Cell is a room.

trapdoor is a door. it is scenery. it is up from Jail Cell.

Freedom is a room. it is up from trapdoor.

instead of going up in Jail Cell:
if the crate is not in-place:
say “You can’t reach it.”;
otherwise:
continue the action.

the crate is a thing in Jail Cell.

a thing can be in-place or not in-place. a thing is usually not in-place.

instead of taking the crate:
say “You can’t really carry it, but maybe you can push it?”

instead of pushing the crate:
say “You push the crate in place under the trap door!”;
now the crate is in-place.[/code]

I’m sure someone can do better than this. But this is a basic way of approaching such a trick.

This should work also.

The dungeon is a room. The living room is a room. A wooden trapdoor is a door. The trapdoor is above the dungeon and below the living room. It is closed and openable.
The supply room is north of the dungeon. A crate is an enterable supporter in the supply room. The crate is pushable between rooms.

Instead of doing something to the trapdoor when the action requires a touchable noun: unless the player is on the crate, say "The trapdoor is out of reach." instead.

The solution here is “north / push crate south / stand on crate / open trapdoor / up”. The player is not allowed to touch the trapdoor until she is on the crate (so e.g. “open trapdoor” and “touch trapdoor” will fail, but “x trapdoor” will succeed), and going up is blocked by the closed-ness of the door.

What is the result of “north / push crate south / stand on crate / open trapdoor / push crate north / south / up”?

You could have a ladder fall out of the trapdoor like this to avoid that particular problem. (Since forbidding going up when the box isn’t there is probably just annoying from a gameplay perspective, and anyway a box that lets you open a trapdoor isn’t a box that lets you climb it – that’s why those ladders exist in real life.)

Just some default responses, since I didn’t put any text in there.

Here’s the result of playing it:

dungeon
You can see a wooden trapdoor here.

>n

supply room
You can see a crate here.

>get crate
That's fixed in place.

>push crate s

dungeon
You can see a wooden trapdoor here.

>open trapdoor
The trapdoor is out of reach.

>u
(first opening the wooden trapdoor)
The trapdoor is out of reach.

>get on crate
You get onto the crate.

>open trapdoor
You open the wooden trapdoor.

>u
(first getting off the crate)

living room
You can see a wooden trapdoor here.

You’d presumably put helpful text in the description and appearance of the crate to indicate that you can push it and stand on it.

Note: change the Instead rule to this, I made a mistake in my earlier code:

Instead of doing something to the trapdoor when the action requires a touchable noun and the player is not on the crate: say "The trapdoor is out of reach." instead.

Thanks for the input! I have:

The small wooden trapdoor is a door. Up the church tower is above the small wooden trapdoor. "From the top of the church tower you have a splendid view of the Soluent to the south and the Meon Valley to the north."  The top of the church tower stairs is below the small wooden trapdoor.

Instead of doing something to the trapdoor when the action requires a touchable noun:
	if the player does not carry something height-enhancing:
		say "You jump in an effort to reach the trapdoor, but just aren't tall enough.";
	otherwise:
		continue the action.

A thing can be height-enhancing.  A thing is usually not height-enhancing.		

North Ticefelle is north of Ticefelle Village. A wooden crate is in North Ticefelle. The description of the wooden crate is "A wooden crate, about as high as your knee.  It's a bit grubby on account of having sat outside for a time, but looks sturdy enough, yet not too heavy."  The wooden crate is enterable, a supporter, height-enhancing and portable.

Now. I’d like to be able to add something that says: “You clamber up on the [height-enhancing thing]”, but I can’t work out the syntax.

I think it’s

After getting on [onto?] crate:
Say “You clamber up on top of the crate.”

You can play the game and type “actions” before doing it to see the correct action inform is using.

Try this for your Instead rule.

Instead of doing something to the trapdoor when the action requires a touchable noun:
    if the player is on something height-enhancing (called the prop):
        say "Standing on [the prop], you easily reach [the trapdoor].";
        continue the action;
    otherwise if the player can see something height-enhancing (called the prop):
        say "You slide [the prop] into position beneath [the trapdoor] and clamber up onto it.";
        move the prop to the location; [This prevents the player from trying to climb onto a carried thing.]
        try entering the prop;
        if the player is on the prop, continue the action; [If it failed because of a more specific rule, deny access to the trapdoor.]
    otherwise:
        say "It is out of reach." instead.

Brilliant. Thanks very much. How do I prevent messages such as:

I’d like not to see the

bit.

Testing commands are useful here; namely Actions, in this case.

[rant=example]>actions
Actions listing on.

u
[going up]
(first opening the small wooden trapdoor)
[(1) opening the small wooden trapdoor - silently]
You slide the wooden crate into position beneath the small wooden trapdoor and clamber up onto it.

[(2) entering the wooden crate - silently]
[(2) entering the wooden crate - silently - succeeded]

[(1) opening the small wooden trapdoor - silently - succeeded]

Up the church tower
From the top of the church tower you have a splendid view of the Soluent to the south and the Meon Valley to the north.

You can see a small wooden trapdoor here.

[going up - succeeded][/rant]

So that tells you the offending message is printed as part of the ‘going up’ action. Then, in the Going page of the Actions subtab of the Index tab, we find that the rule is called the “can’t go through closed doors rule”, and the message is called the “can’t go through closed doors rule response (A)”.

The can't go through closed doors rule response (A) is "[if the door gone through is not the trapdoor](first opening [the door gone through])[end if][command clarification break]". is the simplest way to prevent this being displayed about the trapdoor.

Thanks - very useful. I shall have more of a poke in the actions index! So, the conditionals go in the text? Could I, for example, set the can’t go through closed doors text to be something else dependent on the location? I tried:

In top of the church tower stairs, the can't go through closed doors rule response (A) is "New text."

…without success.