A way around one source file limit

Hello, I’ve been playing around with the one feature of Inform 7 that makes me see red, the damnable use of a single source file, and eventually I came up with this simple bash script:

pastebin.com/Q9W7zyEX

It requires two things as it is, but both of them are easily changed in the script:

First, that your projects are saved in the same directory (for me, it’s ~/games/inform/) with .inform/ and Materials/ under the project name (e.g. ~/games/inform/My Awesome Game/My Awesome Game.inform/).

Second, that a file called order.txt is in the Source/ directory. The file should have one filename per line, in the exact order in which you want it to appear in story.ni.

As an example, order.txt might look like this:

Introduction.ni
At the Ball.txt
Intermezzo
Aftermath.ni

All of these files need to be in the Source/ directory. As the story.ni file is rewritten every time the script is run, these files have to contain everything, including the “My Awesome Game” by “Secret Nickname” line (which should be the first line in Introduction.ni in this example).

The script requires i7 to be installed in your path.
It can be invoked simply as script, which only compiles the source, or with several optional arguments:

-p runs the compiled file in an interpreter of your choice
-r releases the game
-b blorbs the release (implicit)
-b does NOT blorb the release
-z # switches formats (5, 6, 8, or g)

The main disadvantage of this approach is you can’t use the IDE for working, just for checking, as everything new in story.ni will be overwritten by the script, but if you want to use more than one source file, you’re probably using a proper text editor for writing anyway.

Otherwise, the script is very dumb, it does minimal checks, it reports virtually nothing, and there’s every chance it borks up something important, so read before you use, please.

I hope it will be useful to some people, and I will be glad for any improvements people more skilled than me can make.

EDIT: I have added a way to put Inform headings into the order.txt file. The headings have the form of e.g. +Part 1 - Boring Stuff with the + sign at the beginning of the line.

Cool Birion, this looks very useful.

Incidentally I think the new Windows release has a new (?) feature that lets you use an external text editor with the IDE (the source pane reverts if the source has been changed by an external program), I wonder if this will get added to Mac/Linux?