Door problem 2

I have a room which is above another which I want to the player to place a ladder in some holes in the floor to access. Is there a way to put a door (in this case the panel) in a room but out of reach or blocked unless the player does a certain thing?

Also as you can see below, I’m trying to allow the player to put the ladder in the holes (acting as a container) but I’m not sure how.

The panel is a locked door. 
The panel is scenery.
The panel is above the Ancient Slavery Exhibit and below the Abolition's Birth room.

The holes are here.
The holes are scenery container.
The description of the holes are "These holes go into the floor for about 3 inches and are roughly an inch in diameter."
Understand "put [text] inside [holes]" as putting it inside holes (with nouns reversed).
	say "The ladder legs fits perfectly into the holes, a click indicating it is now locked into the floor. The ladder now leads up to a panel on the ceiling."
	Now the panel is unlocked.

This is an easy thing to do – you could do a Before rule cueing off of attempts to go up from the Ancient Slavery Exhibit, or, as I think you’ve started to work up here, an After or Carry Out rule cueing off of inserting the ladder into the holes.

The syntax you’re using is pretty off, though – you’ve got operative commands (the “say” and the “now the panel”) nested under an understand statement rather than a rule header. The Understand command also has problems because the syntax you want already exists – it’s part of the built-in inserting it into action – but now you’re allowing the player to put any text into the container, instead of actual objects, which I don’t think is what you want.

I’ve worked up a quick way to do this, but I’d really recommend you spend some time working through some of the foundational pieces of the documentation, especially Chapter 7 of Writing With Inform which talks about actions and I think does a really good job of walking through how to do this stuff. Folks here are always glad to help, but it’s pretty easy to get into trouble just pasting in isolated bits of code you get from different forum posts, since they might not play well together, so I think you’ll be in better shape with some deeper grounding in the basics!

Ancient Slavery Exhibit is a room.  The Abolition's Birth Room is a room.

The ladder is an object in Ancient Slavery Exhibit.

The panel is a door. The panel is scenery.  The panel is closed. The panel is above the Ancient Slavery Exhibit and below the Abolition's Birth Room.

The holes are in the ancient slavery exhibit. The holes are a scenery container. The description of the holes are "These holes go into the floor for about 3 inches and are roughly an inch in diameter."

After inserting the ladder into the holes:
	Say "The ladder legs fit perfectly into the holes, a click indicating it is now locked into the floor. The ladder now leads up to a panel on the ceiling."
Before going up from the Ancient Slavery Exhibit:
	If the ladder is not inside the holes, say "The panel is too high for you to reach." instead.
1 Like

So this is the response it gave me with this code:

Problem: You wrote ‘After inserting the ladder into the holes’, which seems to introduce a rule taking effect only if the action is ‘inserting the ladder into the holes’. But that did not make sense as a description of an action. I am unable to place this rule into any rulebook.

Thank you again. I’ve read through the documentation but for some reason I can’t get my head around some of the mechanics. I feel so dumb. :frowning: I’ve ordered the book and hopefully it will explain things better. And since my game is working from a handful of play methods, every time someone helps me here I’m able to fix other similar problems. Again I very much appreciate the lessons and wish I could return the favors.

For the error, did you create the ladder object (see line 2 of my code)? If not, that would make the compiler give you this complaint. Otherwise it’s working for me so not sure what could be causing the issue.

Glad the support here has been helpful, and apologies for giving you advice you’ve already tried to follow! The main reason I made the suggestion is that it seems like you might be a bit fuzzy about how to tell Inform to do stuff, which isn’t just a syntax thing, it’s a conceptual thing that might make lots of stuff harder. If you already get all this, sorry for belaboring the point, but here’s a quick summary in case it’s helpful (this is a bit oversimplified but hopefully communicates the concept):

Broadly, you can divide the code in your game into two parts – things that tell the compiler about the initial state of the world, and things that tell the compiler how those initial conditions will change over time. So when you’re creating rooms or objects, or using Understand commands to tell the parser how to translate player input into actions, or writing descriptions, that’s all bucket one. Bucket two is telling the game to display text at a particular time using the “say” command, or writing how new actions work, or creating custom responses or condition changes for existing actions, or things outside the player’s direct control like timed events, NPC activity, etc.

The key thing to understand is that everything in bucket two needs to be included in a rule of some kind, so that Inform knows when and how to trigger the change. So that’s why rules always include a first line stating when they run – “every turn when the player is in the kitchen”, “before taking the branch,” “instead of asking someone about when the noun is the Oracle of Delphi”, etc. After this initial bit, they have a colon, and then the code for what happens when the condition is met needs to be indented below, with semicolons after each statement.

Of course rules can get really elaborate, with more nested ifs, elses, and otherwises – or they can be simple one-command things, in which case the syntax is likewise simplified so you don’t need the colon or nested newlines (you can just write “Instead of taking the ladder, say ‘That’s too heavy to lug around.’”) But anytime you’re writing code that changes the state of the world, you should be doing it inside a rule. Beyond the small syntax issues, that was the problem with your example code in the first post – you had state changes (unlocking the panel, displaying text with a say command) that wasn’t part of a rule, but instead nested under an Understand statement.

Hope that makes sense – most of Inform 7 is I think learnable through deduction and analogy from looking at examples, but the thing about rules is a little trickier to suss out just from looking at how folks are solving specific issues so that’s why I thought it might be worth writing up in more detail!


Yes, the missing ladder was the problem. I had planned to put it in another room but hadn’t done it yet.

I very much appreciate your advice and counsel. You’ll never insult me by trying to help. I like your bucket analogy. I’m a visual learner and I think that’s why your example translates better for my brain.

Thanks again and hopefully I won’t get too annoying with my questions.

1 Like