A Tale of Two Languages

 in
Inform version 6 and version 7 are about as different as two languages can be, so your choice of which one to use for your next great game boils down to personal preference.

The differences between the two languages are apparent from the first lines. When starting a story in Inform 6, there are some essential housekeeping duties that need to be done at the beginning (i6:001-007) and end (i6:172-193) in order for the story to compile (Listing 2).

In Inform 7, the only thing that is absolutely required is the first line (i7:001). To be fair, the initialization routine in Inform 6 also includes the message that is displayed at the beginning of the game. In Inform 7 this also is there (i7:007-011), but it's not required for successful compilation (Listing 3).

The defining of variables is similar in both versions—for instance, the maximum score variable (i6:009, i7:005). The main difference is that the Inform 6 version uses C-like syntax:

Constant MAX_SCORE = 6;

And, Inform 7 uses a sentence that reads similarly to how one would read the Inform 6 version out loud:

The maximum score is 6.

Some of the differences between versions are similarly minor. One example is the method of inserting paragraph breaks into long sections of text, such as in the description of the Server Room (i6:114-118, i7:082-086, Listing 4). In Inform 6, two carat symbols (^^) are used, and in Inform 7, the statement paragraph break enclosed in square brackets ([]) does the job.

One big mistake I made when I started was creating everything first in Inform 7, and then creating the equivalent Inform 6 code. This proved tricky on a couple occasions—most notably with the random beeping messages that appear at every turn while you are in the server room (until you fix the server and win the game). Programming such logic is very different in each version. In Inform 7, writing this took almost no thought at all (i7:097-103). Basically, I described what I wanted to happen every turn, and Inform 7 made it happen. The Inform 6 code to do the same thing is not as advanced (i6:120-134). It's basically a case statement, but it's significantly more difficult to write in comparison (Listing 5).

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

The Link to the files

Anonymous's picture

The link in the magazine was incorrect. The files are actually located here:

ftp://ftp.linuxjournal.com/pub/lj/listings/issue174/10130.tgz

One other thing to keep in mind: if you want to compile the code, first remove the line numbering.

Looking for code...

augmentedfourth's picture

I'm also curious where the code is!

The Link was incorrect

Webmistress's picture

But is fixed now.

Katherine Druckman is webmistress at LinuxJournal.com. You might find her on Twitter or at the Southwest Drupal Summit

Ah... I had been trying to

augmentedfourth's picture

Ah... I had been trying to get the code from the link within the article, not the link at the end. The link in the article should be updated as well.

Unavailability of sources issue 174

Anonymous's picture

I know Linux Journal has been getting worse lately but this is the first time that the sources for an issue are entirely unavailable. The credit crash hitting linux journal already?

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState