Dabbling with Inform 7

Every now and again I feel like trying to learn Inform, or at least the basics just to get an idea of how things work. I don’t have a game in mind, I just feel like putting this here and that there and seeing what happens when I do.
I’ve tried a few times before over the years but maybe posting this will encourage me to actually make something with it. Who knows. It might just end up being an oldschool tour round my house since I’m not at a university. :slight_smile:
I do wonder about writing a game from a non-visual perspective though. I haven’t played many that do, and the only one I can think of was a TADS game called World of Darkness by DreamtechInteractive.

Quick update:

I’ve been following Jim Aikin’s Inform Handbook, which is what I used when I last tried learning Inform. Glad it’s been updated to support the latest version.

so far I’ve found I’ve had no trouble understanding what the code is doing, and the only issues I’ve had is when I’ve forgot punctuation or end up using the wrong brackets. I wish the compile error messages would say “You’ve used the wrong brackets” rather than going off on one about something completely different.
I’ve made the forest example from the handbook. It amazes me every time something I’ve typed in works, like there’s a stone wall which prints a different description depending if you’re in the room with the wall in or the one next to it. It’s all basic stuff to a lot of you in here I bet but to me it’s really cool.

The puzzles section will be interesting.

Edited from a Mastodon post I wrote on Friday.
In Friday’s inform7 dabbling:
Still reading Jim Aikin’s Inform 7 Handbook.

  • I have made a secret door in the panelling of a billiards room with a room behind it.
  • I’ve learnt how to have things you drop fall out of a tree and land in the forest below.
  • I’ve learnt how to create backdrops like fog that only appear in certain locations, and given the player character a giant bellows to deal with the fog, revealing the exits.

It was interesting to see how I could develop puzzles.

the bit on fog was frustrating because the if statements kept failing, even though it looked like I had copied everything exactly from the book. The compiler kept reading them as a “say”. But what had happened is that I had forgot to add the fog backdrop I was telling it to deal with.
then the code indents got me. The PDF I’m reading doesn’t have the tabs displayed in a way my screen reader can read so I ended up guessing until the compiler was satisfied. I can read the tabs in the IDE.

If I’m understanding it correctly, the next line after one with a colon will be indented, and the next after a semicolon will be at the same level?
I get that colons seem to set up if statements but I’m not sure what the semicolon does. I assume there’s a section in either the handbook or Writing in Inform that explains it.

Yes! A colon introduces a “block”; everything after it on the same line, or on following lines with an extra tab, belongs to that block.

You can also use the words “begin” and “end” if tabs get annoying. (“If the noun is the fruit begin; say “Delicious!”; end if.”)

The semicolon means “this is the end of the sentence, but not the end of the rule”. A period means “this is the end of the sentence, and the end of the rule”.

This isn’t entirely accurate though? The next line after a semicolon could either be at the same level or less indented. I don’t think there’s any good way to distinguish them if the tabs are invisible.

Probably better to use begin and end if you have problems with tabs. Though, that doesn’t help that Aikin didn’t. Are you reading a PDF version of the guide? An HTML version might be more friendly, tho it might also be less up-to-date.

Yes, the PDF version that’s on the IF Archive.

I think PDF doesn’t encode indentation as indentation. It just encodes “draw the text further to the right”. So that would explain your problem. Again, if you can find a version in a different format, that would probably make things easier. I know there was an HTML format at some point (I was perusing it a bit), though I don’t know if it’s up-to-date.

The versions of Jim Aikin’s Inform 7 Handbook that I’m aware of are listed on his IFWiki page.
The most recent non-PDF version I’m aware of is version 2.0, May 2015, for Inform 7 version 6L38 (retconned as 9.2; from 2014).

I saw that one. I’m not sure of what’s changed in the language between that version and the current one so I’m reluctant to try it.