Is there an object model doc for Inform 7?

I’m an experienced programmer who’s trying out I7 and quite enjoying it, but finding the hours spent playing guess-the-right-combination-of-words rather tiring. I’m looking for a place I can go and get chapter-and-verse about what a given built-in thing makes available etc, like the javadoc for an IDE.

The Standard Rules is close to what I want but but it’s tough to use. As an example, I’m currently trying to see how to properly refer to the list of objects that are in the room the player is in. I’ve read SR1 and SR2 end to end but am none the wiser, though it’s taken up most of an evening.

You might try this thread for several different approaches to documentation. I don’t know if anyone’s written up a formal object model, though.

As for your example:

[code]the list of things in the location of the player [if you’re concerned with direct containment only]

the list of things enclosed by the location of the player [if you want to count things inside of things as well][/code]

Make sure you give the Index a thorough read too. It doesn’t tell you everything, but it tells you a lot.

There is no formal object model because I7 isn’t formally organized into objects.

For your question, you are looking for one of the built-in relations (containment or enclosure). But to use it, you need to know how to talk about things related by a given relation. The SR don’t get you very far here because relations are a core language element – see the manual starting 13.1.

Getting a list of things is in the SR:

To decide what list of Ks is the list of (D - description of values of kind K): ...

I guess the documentation you’re missing is a summary of what descriptions are (and how they’re built from relations and adjectives).

This is tangential, but I’ve seen it a couple of times in recent questions:

People often reach for a dynamic list (“list of…”) when a description will suffice. A dynamic list is slower and requires memory allocation.

In general, a list is only necessary if you want to store current information for future reference. (The description “all things in the location of the player” changes from turn to turn.)

I usually try to stop myself from trolling here … but since this is your first post on the forum, perhaps it’s not out of line for me to suggest that since you’re an experienced programmer who is comfortable with an object-based language, you might possibly want to take a look at TADS 3. You’ll find this type of question rather more easily answered in TADS 3, I believe, and you’ll seldom have to guess the right combination of words, as its syntax is closely based on C.

Try “Inform 7 For Programmers”
plover.net/~pscion/Inform%20 … ammers.pdf

1 Like

Thanks everyone for the pointers. The posts mentioning descriptions are useful – I had naively taken a description in Inform to be just a special kind of text, and hadn’t realised they had structure I could interact with.

I will have a look at TADS, but I’m going to persist with Inform for a while as there are things I like a lot about it and I’ve only been at it a few days.

I’ve also found an all-in-one PDF of the Standard Rules, which makes searching easier and is helping with answering some of these questions.

The term “description” is a little bit dangerous. It has two different meanings:

  • Things and rooms have a “description” property, which is a text property printed when the player looks at them.
  • A “description of (class K)” is a type in Inform.

The second one of these isn’t something the player will ever interact with. But when you use a construction like “repeat with the portal running through open doors”, it’s calling a function (“repeat with…running through…”) with the second parameter being a “description of doors”.

Most of the time you can use descriptions without worrying about how they actually work. They’re basically the name of a type (“doors”), combined with a set of modifiers (“open”), and Inform is designed to loop through them very efficiently. This is why things like “now every open door is closed” are idiomatic in Inform.