Roger Firth's IF pages


InFancy -- using Inform objects

Back up

InFancy is another Inform overview site, like InfLight and InfAct. This time around, we're covering the basics of object usage, creation and naming, then showing how to build on those basic concepts in more sophisticated ways.

The material is loosely organised as follows:

Object headers
The Object directive (or more specifically, its first line).
Object bodies
More on the Object directive; the with and has segments.
Properties and attributes
Objects have 'em: what's the difference?
Puppy-training: teaching an object to respond to its own name.
What you see in room contents and player inventories.
"So, tell me about yourself..."
Make the mould once, then send in the clones.
Dynamic objects
Creating an object at run-time, before your very eyes.
The final game
Alright alright, 'game' is overstating it. The code wot we wrote.


To clarify where the various example displays come from, a little colour-coding is used:

This is a sample of text in an Inform source file.

This is from a Z-machine interpreter at run-time. 


Thanks to Neil Cerutti for good food, fine wine and general behind-the-scenes support and guidance (ok, I lied about the food and the wine). And of course to Graham Nelson, ever-present in spirit (if not necessarily in body).

And with those few words, off we go!