[I7] climbing stairs - up and down

Hi again.
I’m not sure if what I want is even possible. I can’t find anything that leads me to any sort of answer in the docs. the code I have is

[code]The Lab is a room. “Some stairs rise to somewhere above you and also descend to a dingy darkness below.”
Down from lab is Storeroom.
Up from Lab is attic.

Stairs are scenery in lab.
Before climbing stairs:
[ say “Just use the direction on its own - up or down.”;]
say “[the noun] , [the second noun]”;
Try going;
Stop the action. [/code]
I have tried using ACTIONS but even that is not giving any clues. (at least to my 60yo brain)
I need to find a way to capture the command when the player types ‘CLIMB’ by itself or ‘CLIMB STAIRS’ so that I can prompt for a direction.(Up or Down)
I have put the line to say the noun and second noun in order to see waht Inform thinks the parts of command are. The docs say that Up & Down are a special kind called Direction, yet elsewhere I found the directions referred to as nouns. Hence my confusion. Adding [Direction] to the say phrase gives an error.
These are some of the results I get.

In my WIP, I have ‘There is a stairway leading both up and down here as well as doorways to the North, South and West…’ in the room description so it looks like I may need to change one of them to a passage or some other form in order to remove any ambiguity.

Again all help appreciated. Thanks.

The problem is that the “try” phrase tells Inform to try the given action itself instead of asking the player for another command. So if you’re using it you need a whole action after it, like “try going up” or “try putting the beaker on the table.” When you write “try going” Inform just thinks that you’re telling it to execute the going action without any direction specified, and it can’t do that. So you need to give the player a chance to type a direction.

Fortunately, in your case you don’t need to do anything fancy – since “up” and “down” by themselves are understood as commands, you can just kick the player back to the normal command prompt. If you want to intercept all “climb” commands this way, you can use “Understand as a mistake” from section 17.20 of the manual:

[code]The Lab is a room. “Some stairs rise to somewhere above you and also descend to a dingy darkness below.”
Down from lab is Storeroom.
Up from Lab is attic.

Stairs are scenery in lab.

Understand “climb” or “climb [stairs]” as a mistake (“Just type the direction you want to climb, ‘up’ or ‘down.’”).[/code]

And then the game will respond to these commands just by printing the message and waiting for another command. If the player then types “up” or “down” it’ll work according to the normal action-processing rules. And if they type another command instead it’ll work, which will be fine.

If you want to add conditions then I don’t think the “mistake” machinery will work (EDIT: Wrong, see below in thread) so you might want to use a before rule. (A complication is that this will invoke the every turn rules etc., whereas the “mistake” won’t.) Actually your rule should be fine if you just leave out “try going”:

Before climbing stairs: say "Just use the direction on its own - up or down."; Stop the action.

To take care of climb up and down you might want to redirect “climb up” and “climb down” to the going action:

[code]
Understand “climb [up]” or “climb [down]” as going.[code]

(I put “up” and “down” in parentheses so the game will understand any synonyms for them we might have.) You could actually restrict this one so that it only works with the stairs, by adding “when the stairs are visible” to the end, but it really seems like it ought to work whenever you can go up or down. Maybe if you have some other climbable things in your game you’d want to tweak it.

Putting this together I have:

[code]The Lab is a room. “Some stairs rise to somewhere above you and also descend to a dingy darkness below.”
Down from lab is Storeroom.
Up from Lab is attic.

Stairs are scenery in lab.

Before climbing stairs:
say “Just use the direction on its own - up or down.”;
Stop the action.

Understand “climb [up]” or “climb [down]” as going.[/code]

Oddly enough this interprets “climb” by itself as “climb up” but that seems OK. Well, maybe not in the attic.

BTW you might want to look into making the stairs a backdrop so they can be in the attic and the basement as well.

Thanks Matt (again)
I only had the ‘Try going’ phrase in there in order to see from ACTIONS what was going on to determine what I needed to trap.

After testing both the mistake code and the last one with the extra understand rule, I think the last one will fit into my game OK. Generally speaking, we speak of climbing up stairs but just going down (stairs) but I was trying to ensure I had caught everything. If you saw the original C64 BASIC code, it just responded to Up or Down. (But what else would you expect in 1984 when everything had to be squashed into 4k of RAM and sometimes even less.) Actually the game was an example in the back of a book and you needed the book to play it as all the verbs & nouns were a single letter (A-L for verbs & A-W for nouns) Translating this has not been easy. At the end of this I hope to have a much fuller game/story.

I didn’t realise I could use the [ ] brackets around a word to catch it and its synonyms. Thanks.

Backdrops are something I have only just started to try. - working on a door at the moment so I’ll see how I go with the stairs.

Maybe I’m trying to be too perfect with this as its the first time I have tried using I7 but I’ll get there. I keep seeing the criticisms of others who leave out descriptions of scenery, etc and think that I don’t want to do that.

Thanks again.

Bumping to correct a mistake I made before: Understand as a mistake works fine with “when” clauses, I had just messed up the syntax when I tried it. You can say:

Understand "climb" as a mistake ("Just type the direction you want to climb, 'up' or 'down.'") when the stairs are visible.

The quoted text always has to go immediately after “mistake.” Sorry for being misleading!