Getting default for a closed/open door, and About section

Hey All-
I’m wrapping up my first game! A big thank you to everyone who has been so helpful here.
I have 2 last questions:

1.) Is there an easy way to get doors that are open or closed to say so in the locale description? I have a closed box is the game, and the locale description automatically gives this information like so:

You can see a little box (closed)

But this isn’t the case for doors that are open or closed- they still are just described as a door. This surprises me- it seems that there might be an automated way built into inform to do this, as there is for a container. Is there, or do I need to code it?

2.) I couldn’t find anything in the documentation on a standard way to make an “About” section, so I did it like so:

When play ends: 
	say "Would you like to read the About Section? >";  
	if the player consents: 
		say "Stuff about game. Thanks and acknowledgements to... yada yada yada."

Is this acceptable? Or is there a preferred way to do this?
Thanks again, y’all. Your help has been invaluable.

On 1, I believe you do need to code it, but fortunately it’s pretty simple – this should work:

Rule for writing a paragraph about a door (called the foo):
	If the foo is open:
		Say "You can see [the foo] (open) here.";
	Otherwise:
		Say "You can see [the foo] (closed) here."
	

(See 11.24 of Writing with Inform)

On 2, I’d think that’s fine, though if your About text also includes credits, or information that would be helpful for a player just starting the game, I’d probably want to make it accessible even to a player who doesn’t finish the game. A simple way to do that is to just define a new out-of-world action with the text you’d like to include:

Understand the command "about" as something new.  Understand "about" as aboutening.   Aboutening is an action out of world applying to nothing.

Carry out aboutening:
	Say "Four score and seven years ago..."

You can also, or instead, change the default options available to a player after finishing the game if you want to add ABOUT, or NOTES, or some other additional choices. The examples in 11.6 of the Recipe Book show some possible ways to do all this. Though again, I think your approach is fine!

2 Likes

A small oversight: you need to write “if the foo is open:” there, in order to refer to the particular object for which you introduced the variable-name foo, otherwise you’ll run into trouble when there is more than one door (because IIRC, Inform treats “if the door is open” the same as “if a door is open”, so it will show the “open” description for all doors, if one of them is open).

Unrelated to that, a different approach to 1 would be to use “Printing room description details of something”, see 18.16. Printing room description details of something.

Rule for printing room description details of a door (called d):
	if d is open:
		say " (open)";
	otherwise:
		say " (closed)".
1 Like

Ah, good catch! Updated my post to minimize confusion.

1 Like

Thank you!
I was working on code for the door, and it was more unnecessarily complicated than yours, like pretty much every bit of code I write. As I get better at the language, I go through the game and see these long, convoluted commands I wrote early on that I got to work after hours of torturing the language, and now I see a much simpler solution. I suppose that’s normal?
I’m still just a little surprised that this is automatic for containers but not for doors. I wonder why.

And I’m taking your advice and adding an ABOUT command. I had a HELP already, so not sure why I didn’t think of doing it like that. It is hard to pound all this into my rusty brain.
Thanks again- that was really helpful!

1 Like

Some (a lot? Well, the longer they’ve been playing, the more do it) players will type ABOUT and/or HELP and/or CREDITS as soon as they enter a parser game, so it’s a good idea to have those commands covered. Whether or not they’re all unique in output. Sometimes HELP and ABOUT are used for the same thiing, in which case one can be made a synonym for the other, etc.

-Wade