Creating a closet

I’m sure this has been asked before I just cannot seem to find it anywhere. I am trying to create a closet which I have done with:

a closet is a container in the dorm room. “A closet door is blahblah[if closet is closed] and a full length mirror mounted on the other door.[otherwise]. Stuff in the closet”.
a closet is openable and closed.

this works just fine in the sense that I can type open/close closet and then whenever I look I get the correct text for whether the door is open or not. However I would like to be able to over ride the default text for opening/closing the door to describe the squeaky door and also initially describe the scene, which I have done with:

instead of opening the closet,
say “The door does not slide blah blah”.

that worked as expected for the open closet command, but now the closed is not known to be open so if I do a look in the room I do not get the [otherwise] description from the previous block. I have tried setting closet is open but that is giving an error, any guidance on what I am doing wrong ?

thank you

nevermind on this, I just discovered after and before instead of instead…so I changed my previous stuff to be using after opening the closet and now I have the behavior that I was looking for

3 Likes

You also want to make sure that the closet isn’t something that the player can just pick up and take off with, by calling it scenery–

A closet is a container and scenery.

Inform 7 assumes that when you create an object, and don’t call it scenery, a backdrop, a person, a supporter, or define it as ‘fixed in place’, it’s automatically a takeable object.

Of course, scenery objects do not get an ‘initial appearance’ paragraph, so you might want to include it in the room description, in which you can have the [if the closet is closed]…[otherwise]…text substitutions.

Also, remember to allow the player to refer to the closet in other ways, using Understand, with synonyms–

Understand "dorm" or "door" as the closet.

This will allow the player to refer to the closet as a ‘dorm closet’ or ‘closet door’–but if you have other objects whose names contain ‘dorm’ or ‘door’ you can say–

Understand "dorm closet" or "closet door" as the closet.

This will keep the player from having to be more specific when he types ‘open door’ (when there is also a hall or dorm door), or avoid ambiguity when he types ‘search dorm’ (when there is also a dorm window or dorm bed).

1 Like

By the way, when you include your game’s code in your posts, precede it with three backticks on their own line (```), and add another three backticks on their own line, after the code. In the resulting post, your code will appear like mine above (the backtick key should be to the immediate left of the 1 on your keyboard).

As another by-the-way, WELCOME to Intfiction.org.

1 Like

sorry about the backticks, so just like a code block in Discord then, nice :slight_smile:

excellent with the scenery much more elegant than my instead of take I was doing to prevent that exact issue.

Good point with the understand, biggest pitfall of the developer is to assume the player plays the game “correctly” lol

thank you for the welcome tons of awesome info here !

1 Like

Alternately if you don’t want the closet you to be scenery (so it will show up in your room description) you can also declare it:

The closet is fixed in place.

Containers default to portable and supporters (and scenery) default to fixed in place, but you can change that as necessary…such as if you want a card table the player can carry around.

The card table is a supporter in Game Room. It is portable.

2 Likes

thank you for that as well, I think that grammatically I like the fixed in place over the scenery, but they both seem to do the job just fine.

I’m so used to object oriented programming I keep rushing ahead of my Inform knowledge, but am definitely enjoying this learning process

1 Like