Monday, November 18, 2013

Inform 7 First going.

So I've started using Inform 7 for writing IF (interactive fiction). I've used Inform 6 before and TADS, which I'm pretty partial towards TADS.

However, I've decided to give Inform 7 a go.  It's programming syntax is described as natural language.  Here is an example of me creating a room object, creating an enumerated property, creating a generic object, giving the generic object the enumerated property, and creating a few instances of the new object type.

Your Apartment is a room. 

Color is a kind of value. The colors are red, blue, and green.
A car is a kind of thing. A car has a color. The color of the car is blue.
Before printing the name of a car: say "[color] ".

The North Car is a car.
The South Car is a car.
The color of the North car is red.
The North Car is in your apartment.
The South Car is in your apartment.

Now obviously, I hope you don't really find cars in your apartment.  However this illustrates pretty well the construct of Inform 7's language.  I've created a room call "your apartment"  Created the enum color and given it {red, blue, green}.  Created a car type which has a enum value and set a default value of blue.  I've overridden the print name method of a car type to print the color, and I created two cars [North Car, South Car] and given North Car the color red.
So it's a little weird to work with at first and I'm still struggling a bit with the syntax but hopefully, I'll be able to do my first five room adventure with Inform soon enough.

Wish me luck!
Post a Comment