Is there an easy way to work with duplicate things? I have a room with 6 beds and 6 footlockers. I must repeat everything for each and the room description shows a clutter of repeated phrases. Here is what it looks like:
[BARRACKS]
Barracks is west of N-North Corridor. Exit of Barracks is "E".
Description of Barracks is "This rectangular room is the acolytes[apostrophe] sleeping quarters--barren and plain.[no line break][run paragraph on] [Description of cots]".
Cots is scenery in the Barracks. Description of cots is "Six cots are aligned along each wall in a tidy array. Beneath each cot is a footlocker.".
Understand "(none)" as plural of cot.
A clerical-cot is a kind of enterable supporter.
Description of cotView is "A thin mattress in a wooden frame. The acolytes who slept here were not accustomed to luxury. Under each cot is a letter painted on the floor: A, B, C, D, E, or F.".
Understand "cot" as clerical-cot.
cot A, cot B, cot C, cot D, cot E, and cot F are clerical-cots in the barracks.
Description of cot A is "[description of cotView]".
Description of cot B is "[description of cotView]".
Description of cot C is "[description of cotView]".
Description of cot D is "[description of cotView]".
Description of cot E is "[description of cotView]".
Description of cot F is "[description of cotView]".
Understand "lay on [thing]" as entering [thing].
After entering an enterable supporter in barracks:
say "[one of]It feels scratchy.[or]The mattress is too thin to be comfortable.[or]How could anyone sleep on this?![or]I hope it doesn't have bedbugs![purely at random]".
[Suppress the room description when exiting a cot.]
After getting off enterable supporter:
say "(Standing up.)";
stop the action.
test beds with "gonear barracks / x cots/ x cot/ x clerical-cot/ x cot B/ sit on cot B/ get off cot B/ lay on cot B/ get off cot A/ get off cot B/ x cot A/ x mattress".
Footlockers is scenery in the barracks.
Understand "(none)" as plural of footlocker.
Description of footlockers is "A heavy metal box bolted to the floor. Although there is a place for a padlock, this footlocker does not have one.".
A footlocker is a closed openable container. It is fixed in place.
footlocker A, footlocker B, footlocker C, footlocker D, footlocker E, and footlocker F are in barracks.
Yes, I can make beds and footlockers scenery, but then they lose their function as enterable supporters or openable containers, respectively.
So you could say Before listing contents: group clerical-cots together as "cots" or something. That section has other examples that could help.
However, you can make beds and footlockers scenery! It doesnât affect the enterable or openable property at all. You can just say âa clerical-cot is usually sceneryâ. It doesnât cause any problems, and is probably the best solution here. If you add that line to your code, it compiles perfectly.
Just to go back to this opening question, my experience is, not really? The answers below will certainly help, but as youâve noticed thereâs inevitably a certain amount of cruft on both the authorâs and the playerâs side of things â like, as youâve noticed, it can be a pain to wrangle things to make sure objects are displaying and behaving correctly, and on the playerâs side, itâs often a pain to figure out how to disambiguate thing, beyond the potentially credulity-straining idea that the acolytes letter-coded their cots instead of just knowing whose was whose.
There are times when itâs worth paying this tax, certainly, but in many cases, I think itâs the counsel of wisdom to just not get into this mess in the first place. Like, unless youâve got a puzzle or something that depends on which of these identical cots and footlockers are which, it might be better all around to just have a single plural-named âcotsâ and a single plural named âfootlockersâ object; that way the player can conveniently examine them all at once, which is presumably what theyâre going to do, without having to tediously lawnmower through 12 total objects, and you can spend your implementation time on stuff thatâs more important to the game (I note you already have a âcotsâ scenery object, Iâm guessing to catch players attempting to X COTS or whatever, so actually youâre already halfway to this approach).
(Again, not to say this approach is necessarily bad or ill-suited for what youâre doing! But I have some Inform-PTSD from doing a big puzzle involving multiple identical objects, and feel like itâs often been helpful for me after that experience to take a step back and ask âhold on, do I really need to do things this way?â whenever Iâm tempted to do an indistinguishable-kinds thing).
Your current definition of the footlockers has a bug. Youâve created a single footlocker that is a container, rather than a kind, then a bunch of individual footlocker objects that are not containers. Instead it should be:
A footlocker is a kind of container. It is usually closed, openable, fixed in place.
footlocker A, footlocker B, footlocker C, footlocker D, footlocker E, and footlocker F
are footlockers in barracks.
This is usually a good idea for these situations, but in this case, youâd probably have to group the cots together, then the footlockers together. I donât think you can group different kinds of things into one group? And aesthetically, youâd then have to write a description for a group of cots and another for a group of footlockers.
So as Brian said, another good solution is to make the cots and footlocker kinds both scenery, as well as whatever else they are. Youâve already got a basic description of the whole setup in the room description, but just add in the mention of the labelling A-F.
e.g. âSix cots, labelled A-F, are aligned with the wall in a tidy array. Beneath each cot is a matching lettered footlocker.â
I did a quick experiment of putting something on a cot and then LOOKing, and it reads fine.
A last little observation on your code. Since all the cots are identical in description, you can get rid of the concept of âcotViewâ and just give the description to the kind:
The description of a clerical-cot is usually "A thin mattress in a wooden frame. The acolytes who slept here were not accustomed to luxury. Under each cot is a letter painted on the floor: A, B, C, D, E, or F."
Do you mean doing something like this? (using current example, but making cots and footlockers not scenery first.)
Definition: a thing is groupy:
if it is a clerical-cot, decide yes;
if it is a footlocker, decide yes;
decide no;
Before listing contents of the barracks:
group groupy things together;
Rule for grouping together groupy things:
say "the military stuff";
I created âgroupyâ to lump together two kinds. Is that the kind of thing you meant?
Yeah, thatâs exactly the idea I was talking about, although I wasnât sure if it could be applied to the OPâs original example. In playing around with it, however, I noticed an annoying limitation that I donât have time to get into as Iâm on my way to work.
Itâs my impression or your example is inspired by late 1970s-early 1980s D&D/AD&D adventure modules, whose often indulges in detailed description of dungeons (and evil templesâŚ)'s accomodations ?
Thanks for all this help. I will try these ideas out. What I originally wanted was the âListing Contents of Somethingâ which I missed somehow. Iâll let you know what I find.
OK, I tried out some of these ideas. The group idea of cots and their âsubclassesâ worked great, but the lockers failed miserably. Call me dim but I canât see the difference between the two. I get this compile error:
**Problem.** The sentence 'The footlockers are scenery in the barracks' [](source:story.ni#line2019) seems to be telling me that two descriptions, one a form of footlocker and the other of object, are the same. That's a little puzzling - like saying that 'An open door is a container.'
Barracks is west of N-North Corridor. Exit of Barracks is "E".
Description of Barracks is "This rectangular room is the acolytes[apostrophe] sleeping quarters--barren and plain.[no line break][run paragraph on] [Description of cots] [Description of lockers]".
Before listing contents: group clerical-cots together as "cots".
[Before listing contents: group lockers together as "lockers".]
A clerical-cot is a kind of enterable supporter. Clerical-cot is usually scenery.
Description of clerical-cot is "A thin mattress in a wooden frame. The acolytes who slept here were not accustomed to luxury. Under each cot is a letter painted on the floor: A, B, C, D, E, or F.".
cot A, cot B, cot C, cot D, cot E, and cot F are clerical-cots in the barracks.
The cots are scenery in the Barracks.
Description of cots is "Six cots are aligned along each wall in a tidy array.".
A footlocker is a kind of container. A footlocker is usually closed and openable. A footlocker is usually scenery.
Description of footlocker is "Beneath each bed of the six beds is a footlocker.".
locker A, locker B, locker C, locker D, locker E, and locker F are footlockers in barracks.
The lockers are scenery in the barracks.
Description of locker is "A heavy metal box bolted to the floor. Although there is a place for a padlock, this footlocker does not have one.".
When I showme lockers, I get that there is no description, but obviously, it is there in the code. ?!
Good question! Thatâs from me not copying the whole text; looking more closely, theyâre saying that it updates automatically, so that if you are in an area that just has those two (or if you are holding those two) then it would list them like that. If the knife is present, all three will be mentioned!
I think I found the problem. Although I listed the six lockers explicitly, it did not recognize âx lockersâ. I assumed that lockers would be understood as plural of locker, but it wasnât. I even said âPlural of locker is lockersâ-- no joy. As soon as I put âlockers are scenery in the barracksâ, then âx lockersâ gave the group description, as desired.
For those interested, here is the cleaned up code. It must have reduced about 20%.
[BARRACKS]
Barracks is west of N-North Corridor. Exit of Barracks is "E".
Description of Barracks is "This rectangular room is the acolytes[apostrophe] sleeping quarters--barren and plain.[no line break][run paragraph on] [Description of cots] [Description of lockers]".
Description of cots is "Six cots are aligned along each wall in a tidy array.".
Description of lockers is "Beneath each of the six cots is a footlocker.".
A cleric-cot is a kind of enterable supporter. A cleric-cot is usually scenery.
Description of cleric-cot is "A thin mattress in a wooden frame. The acolytes who slept here were not accustomed to luxury. Under each cot is a letter painted on the floor: A, B, C, D, E, or F.".
cot A, cot B, cot C, cot D, cot E, and cot F are cleric-cots in the barracks.
cot A, cot B, cot C, cot D, cot E, and cot F are scenery in the barracks.
The cots are scenery in the Barracks.
A cleric-box is a kind of closed openable container. A cleric-box is usually scenery.
Description of cleric-box is "A heavy metal box bolted to the floor. Although there is a place for a padlock, this footlocker does not have one.".
locker A, locker B, locker C, locker D, locker E, and locker F are cleric-boxes in barracks.
locker A, locker B, locker C, locker D, locker E, and locker F are scenery in barracks.
The lockers are scenery in barracks.
It seems that if a particular object has no description, it borrows it from its parent. âx cot Bâ produces the cleric-cot description. Am I right about this?