Writing New Commands

Hello! I’m rather new to Inform 7 (just learned it this semester for a graduate project) and I am having problems writing/designing new commands.

In the game, you can examine (physical properties) and search (“you find nothing of interest” or “you found…”) doors and things, but I want to add a new command – a REMEMBER command (Ex. REMEMBER CRAYON PORTRAIT - “You remember hearing this about the crayon portrait: …”) – that will give you more information, a memory or a story that you heard, about a given door or thing (multiple objects having their own history that you need to remember).

I’ve read other forums on how to write a new command but I’m coming up with nothing. I’ve very frustrated with it.

So, seasoned IF writers using Inform 7, how would you write this new command?

Thank you
DH

[code]Remembering is an action applying to one visible thing. Understand “remember [something]” as remembering.

A thing has some text called the memory. The memory of something is usually “Nothing comes to mind.”

Carry out remembering: say the memory of the noun.[/code]

You are amazing, Draconis. Thank you so much!

DH

For a REMEMBER command, you may want to check out the I7 source for Bronze, by Emily Short. It’s well written and uses tables to store the memories.

You may also want to look into the extension Epistemology by Eric Eve, for the following reason: The line

Understand "remember [something]" as remembering.

by default only allows the player to refer to objects that they can see. So if they see a clock and walk into the next room, “REMEMBER CLOCK” will yield “You can’t see any such thing.”

In order to allow the player to refer to things that aren’t visible at the moment, you need to add things to scope by hand (with “place [whatever] in scope”; see §18.29 of Writing with Inform) or use something like an “[any thing]” token, which allows the Understand line to apply to any thing whether it’s visible or not (see §17.7).

But in this case you probably don’t want the player to be able to remember any thing, even things they haven’t seen yet. What Epistemology does is to give things a “known” property that keeps track of whether you’ve seen something or not. Then you could write:

Understand "remember [any known thing]" as remembering.

and the parser will understand REMEMBER CLOCK even when the player can’t see the clock, as long as the clock is known.

You can also set things to be known even if the player hasn’t seen them yet, to take care of things that the player starts out remembering even if they haven’t seen them in-game.

(By the way, what “applying to one visible thing” does is to remove the requirement that, once the command is understood, the player must be able to touch the noun; if the action is “applying to one thing” then the action checks a bunch of reaching inside/reaching outside rules to determine whether the player can actually touch it. So the action will still work even if the player can’t literally see the noun, as long as the noun was either added to scope or permitted by the “[any known thing]” token.)

The example “Contemplation” in the Epistemology documentation does something much like what you want (with an action for thinking about, rather than remembering)… though it actually also allows the action to be understood as applying to any thing, not just to any known thing, and defines a similar action that applies to text. These steps are helpful because without them the player would get a not very appropriate error message when typing “REMEMBER GRANDMA” if grandma had either not been seen yet or was not a thing implemented in the world model.

The Epistemology extension is built in to your Inform download, I think, so you should just be able to find it in the Extensions tab and click on it to get the documentation and the Contemplation example.

Thanks, Matt W!