i7: Can a thing be a container AND a device?

Maybe this is a silly question. But - let’s say that there’s a flashlight with the lightbulb missing, and there’s the lightbulb somewhere else, and you can use the flashlight (a device) only if you put the lightbulb in it first.

Am I trying to handle this the wrong way? I probably am.

You can make a container (the socket) part of the flashlight (which is a device). If you then use an instead rule to redirect inserting something into the flashlight to inserting it into the socket, it will behave (from the player’s perspective) like the flashlight is both a container and a device, even though technically it isn’t.

Robert Rothman

Mh, so I need a workaround like this, I can’t have it be both container and socket at the same time. Thanks, I’ll do it like that instead.

A device is simply a thing that can be switched on or switched off
If you don’t need rules that make reference to devices in general, you can just write

The flashlight is a container. The flashlight can be switched on or switched off. It is switched off.

And the flashlight will behave as a device.

There is one other thing that devices do by default, and that is that when you examine it, it will print a message that it is “currently switched off” (or on, as appropriate), after printing the description. You might want to duplicate that also, if you are making a pseudo-device:

Instead of examining a switched on thing, say "[description of noun] Right now it's on." Instead of examining a switched off thing, say "[description of noun] Right now it's off."That will also suppress the container’s default behavior of saying, e.g. “In the flashlight is a bulb” when you examine it.

I’m fine with there being the message “in the flashlight is a bulb” (although perhaps worded differently), since it helps the player keep track of the bulb (i might decide to put a subsequent puzzle where you need to take the bulb back out of the flashlight, you never know :smiley:

Anyway, thanks for all the input! I guess my first IF is done. 6547 words, 12 rooms, 57 things, about 60 moves from start to end knowing already what to do. No real plot, just a little escape-the-building puzzle-romp. I think I get the basics of Inform 7 now.

Well, off to plan my first “actual”, “serious” IF, I guess :smiley:

If you haven’t had someone else beta it, it might be worth it, just to see the sorts of stuff you’re missing. That can be an interesting experience.

I’m already looking for beta testers, don’t worry… I realize the importance that a good round of beta testing/reading can have on any piece of software OR fiction… I guess that goes double for something that is both software AND fiction. :smiley: