I’m sure this is a dumb question, but I just can’t figure it out: is there a way to make multiple versions of an object in Inform 7? I’m writing a game that takes place in a house and, of course, there needs to be a ceiling in every room but Inform won’t let me add multiple ceilings. I’ve tried making them into backdrops, designating ceilings as a kind of thing, saying that a thing called a ceiling is in the room, but nothing seems to work and I can’t find anything in the documentation mentioning this. I’m sure this has to be a pretty basic thing that I’m missing XP
You can make the ceiling a backdrop, and if needed, override the examine command if you need a different description for different rooms. Otherwise, you can easily make a “kitchen ceiling” for the kitchen, a “dining room ceiling” for the dining room, etc, so that they all have different names.
Edit: If you make the ceiling a backdrop, there should just be one. Then you can use “instead of examining the ceiling when the location is the kitchen: say…” for each room.
Unfortunately, you didn’t give us any code examples of how you tried. Everything above works. @J_J_Guest already posted an idea using backdrops, which should work for most implementations. If you really need to implement ceilings as individual, distinct objects (for example, if you want players to be able to hang stuff from ceilings or write messages on them) you could use duplicates as described in ch. 4.14 and 4.15. You can’t add on parts to rooms, but you can do something like:
A room has some text called a ceiling description. A ceiling is a kind of thing. It is always scenery. A ceiling is in every room. The description of a ceiling is usually "[ceiling description of the holder of the item described]" The Lab is a room. The ceiling description is "It's a boring lab-like ceiling." North of the Lab is the Storeroom. The ceiling description of the Storeroom is "This ceiling needs to be dusted." test me with "x ceiling / n / x ceiling".
Thanks for the responses! It looks like this worked!
This slight variation will also work:
A room has some text called a ceiling description. The ceiling is a backdrop. The description of the ceiling is usually "[ceiling description of the location]". It is everywhere. The Lab is a room. The ceiling description is "It's a boring lab-like ceiling." North of the Lab is the Storeroom. The ceiling description of the Storeroom is "This ceiling needs to be dusted." test me with "x ceiling / n / x ceiling".
Yes. @A_J_Mako’s solution is also more efficient, since you’re not using up memory for extra objects you might not otherwise need. That is probably the way I would do it.
My implementation is really only best for someone who needs distinct ceiling objects or someone who finds this thread based on it’s title.