Help with creating an IF

Hello I have 17 days to create an IF for a school final, and i have never used Inform 7 before. The requirements are

10 “rooms” minimum

  • 5 inventory objects
  • 2 multi-step procedural puzzles. Meaning a puzzle that requires several steps or objects in order to solve. E.g. Find key, clean rust off key, use key to open door.

I have the idea for a murder investigation, and i have started, however when i try to add something or change the text inform 7 seems to not allow it, and I have looked at tutorials online, looked on inform 7’s website and read the guides, but none of it helps.

The issues I’m having are with doors
items being removed from rooms after they are taken
items being removed after being dropped
using items with other items
changing actions
making invisible items

In general, you need to remember that even though I7 looks like English, it’s not; it’s code, and it needs to be used with the correct phrasing. A lot of sentences that are synonymous in English will not work as synonyms in I7.

If you post the relevant parts of your code and the errors it throws up, and describe what you’re trying to do, then we’ll be able to help.

My personal opinion: Your teacher is being very, very unrealistic. Unless, of course, you’ve been studying Inform 7 all year in the class. If your teacher expects you to start from nothing and do something sensible with I7 in less than three weeks, I would say that qualifies as sadism. Unless your class is a college-level upper-division programming class, and maybe even then.

I have two suggestions.

(1) Download my Handbook (from It’s certainly not perfect, but a number of people have suggested that they found it easier to follow than the built-in Documentation.

(2) Don’t try to do anything fancy. You’ve mentioned invisible items. That’s too fancy. Do something straightforward.

Doors: You don’t say what issues you’re having, but in Inform, a door always connects two rooms. That is, you need to do it like this:

The Library is a room. The Front Hall is a room. The oak door is north of the Library and south of the Front Hall. The oak door is a door. The oak door is scenery.

If you start by saying the Front Hall is north of the Library, you’re doomed, because that creates a direct map connection with no door.

You should have no problems with items being removed from rooms or removed after being dropped. That behavior is all handled automatically by Inform. It will only malfunction if you’re introducing rules that mess with the default behavior.

The easiest way to make an invisible item is not to put it there at all until the player notices it. For example:

[code]The Library is a room. “There’s an overstuffed couch here.”

The overstuffed couch is an enterable supporter in the Library. The couch is scenery.

The brass key is a thing.

After searching the overstuffed couch for the first time:
say “Tucked between the cushions, you find a brass key, which you pick up.”;
now the player carries the brass key.[/code]
Feel free to ask more specific questions about your other problems.

Darknessedge only said that they personally have 17 days, not that the assignment gave them 17 days. :stuck_out_tongue: Anyway, the assignment sounds about on par to me, from experiences in classes that involved programming but were aimed at non-majors, although I guess I am assuming college-level.

But yeah, I second the advice to do nothing fancy. Even if you don’t think it’s fancy, try to remove some of the fanciness. And a good first step is to write down exactly what you want some piece of the game to do; for your key example, you’d say something like “The key is found under the doormat, and is dirty when it is found. It can open the door, but only when it is clean. The player can make the key clean only if they are holding the soap.” And then right away you know: 1) the key, the door, the soap, and the doormat are items that need to be made, 2) the key has a dirty/clean property, 3) the door starts out locked and needs a “before unlocking” rule to keep the key from working when it is dirty, 4) the key needs a “before rubbing” rule to keep the key from getting cleaned if the player doesn’t have the soap, and 5) “washing,” “cleaning,” and other such words should be made synonyms of “rubbing.” Some of those individual steps are tricky, but at least you know in advance what they’re going to be.

You’re right, of course. I withdraw the comment. It’s been a long time since I took a class, and I’ve never taken a programming class. Also, I don’t tend to wait until the last minute to do major projects, so I tend to forget that not everyone paces their workflow the way I do mine.

I do think, though, that it would be a bit odd for a college-level programming class aimed at non-computer-science majors to have an assignment that uses Inform. Maybe that’s my anti-Inform bias peeking through, but I can’t help thinking that writing good code in Inform for a beginner-level project won’t tell you very much about what actually happens in ordinary programming, simply because Inform’s syntax is, obviously, very unlike the syntax of any other programming language.

In addition the Inform compiler makes certain assumptions – about two-way passages between rooms, for example – that remain invisible to the novice programmer. In any other programming language, including Inform 6, it’s up to the programmer to list the exits of both rooms when two rooms are connected. I7’s assumption, while convenient for the IF author, would allow the student to draw an inaccurate conclusion about how compilers usually work.

My motto is “Never put something off until tomorrow if you can put it off until the day after.”

Robert Rothman

Yeah, my classes-that-involved-programming really weren’t about learning about code or technique. The main one was “Making Things Interactive,” which sort of inherently required learning to use an Arduino, but that was very much “on our own time,” and we certainly never discussed what a compiler is/does or even much about code abstraction. It was fundamentally a design class, and discussion was more on the “what are we making and why is it interesting” side than “how are we making it.” I’ve also been involved with (taught a guest lecture, sat in on final crits) a “Game Design for Artists” class – again, it was up to the students to pick and learn a language or game creation system, and only a few students had any code experience. It’s sort of the inverse of the situation my CS-type friends had in their “Graphics” class, which was of course about the math-y side of graphics rendering: their final projects were quite visual, but flouted all good taste in composition, typography, color theory, etc.

I definitely agree that Inform would be a very weird choice for a first language as part of a serious computer science curriculum, but more and more non-CS classes are using code in pursuit of art or literature projects.

A good development, in my opinion. Programming fosters a particular approach to problem solving and requires a certain amount of logical thinking, both useful skills to hone and transferable to other domains.

I have figured out most of the stuff on my own at the time I posted this I had 17 days given to complete the project and was given the assignment that day but that is not what is important I am having 2 issues now.

doors are not unlocking. The message I get is that the key doesn’t seem to fit the lock.

and the End game message won’t display.

what I have typed for it is

end story finally saying

“insert ending here.”

and i get an error.

But those are the last 2 errors I am having

Have you specifically declared that the relevant key unlocks the relevant door?

The wooden key unlocks the wooden door.

I believe it should be “end the story finally”.

end the story finally saying "insert ending here".

Hope this helps.

Chapters 3.12 and 3.13 in the Documentation will show you how to get a key to work with a lock.

As you didn’t post your code using the handy Code tag in the forum interface, it’s hard to be sure, but it appears you’ve put two carriage returns after the word “saying”. I doubt that will work. The “end the story” line belongs in a rule, like this:

Every turn: if the player does not carry the banana: end the story finally saying "Whoops! You dropped the banana!"

the door still doesn’t work this what I have typed

the mysterious door is a door. The mysterious door is north of the kitchen and south of the hidden celler. The mysterious door is lockable and locked.

I then added The old key unlocks the mysterious door. to the above code and it was still getting the key doesn’t seem to fit the lock message I then tried

The mysterious door is north of the kitchen and south of the hidden celler. The old key unlocks the mysterious door.

which gave me the message “that doesn’t seem like something you can unlock” I then tried

The old key unlocks the mysterious door.

which gave me the same message.

Have you read page 3.13, as I suggested? Evidently not. If you read that page, you’ll discover that the correct syntax is:

The mysterious door has matching key the old key.

Try that and let us know if it works.

What you’re wrestling with, basically, is the fact that Inform’s apparent ability to compile “plain English” is an illusion. Like any programming language, it has specific requirements for syntax. It only looks like English. It isn’t.

when i wrote that post and posted your post was not there

I tried the code you suggested

The mysterious door has matching key the old key.

but got the message “that doesn’t seem like something that can be unlocked”

Jim, that shouldn’t be the problem. “The old key unlocks the mysterious door” is an acceptable alternative formulation for “The mysterious door has matching key the old key.” In fact, the following compiles and works as it should:

the mysterious door is a door. The mysterious door is north of the kitchen and south of the hidden cellar. The mysterious door is lockable and locked. The old key unlocks the mysterious door. The old key is in the kitchen.

So the problem must be somewhere else.

darknessedge, is it possible that you’ve made a typo somewhere in defining one of the objects? If you misspelled “mysterious” one time it would mess things up. Sometimes a problem is due to a hidden typo messing things up. You might try going to the index and looking at the ‘world’ tab, which will tell you something about the objects you’ve defined, and sometimes tells you that you’ve defined something you haven’t expected to. (For instance, once I wrote “War and Peace is on the table,” hoping to get a Tolstoy novel, and the world tab revealed that I had created two things, one called War and one called Peace.)

BTW, “cellar” is spelled with an a.

Strange! I tried it out and it works for me. Try this.


The mysterious door is a locked door. The Mysterious Door is north of The Kitchen and south of The Hidden Cellar. The old key is in the kitchen. The old key unlocks the mysterious door.

Test me with “unlock door with key”.[/code]

You can say this as well.

The old key unlocks the mysterious door.

It now works thank you