Inform 7: A container that is also a device.

I’ve got a bit of a dilemma on my hands. I’d like to implement a car (which is, of course, a vehicle) and an ignition (which is part of the car). I’d like the player to be able to both switch on the ignition and insert a key into it. But an Inform 7 thing can’t be both a device and a container. I could translate switching on the ignition to switching on the car, but the car can’t be both a device and a vehicle. So what’s the most elegant and functional solution?

Depends on the full scope of your needs for each action … but it’s often easy to build multiple objects that just seem like one object, and work it that way. The car interior can be entirely distinct from the car exterior, for example; the part of the ignition that accepts the key can be distinct from the part you switch (and so on and so forth) and it can all appear seamless to the player with judicious re-direction of verbs and use of hidden object names printed as other things.

It isn’t actually necessary for something to be a device for it to have the basic device functionality. It just needs to have the “switched on” property. So, you can define the ignition using something like this:

The ignition can be switched on or switched off.

…and now you’ll be able to turn the ignition on and off using the standard commands.

–Erik

Thanks, folks. I’m using E. Temple’s solution, a container that “can be switched on or switched off.”