Printing the name of...while listing contents of...

In my review game (I am now going through chapter 18 in the manual), I have a pencil cup, on a desk, in Writer’s Office. In the cup are two pencils.

I am trying to work out how to, in the room description, get the list to say something like–

On the desk are a piece of paper (blank), a radio, and a pencil cup (in which have been forlornly left your blue pencil and a short pencil).

Mainly the phrase after the pencil cup. I have tried a number of things, such as–

Rule for printing the name of a writein[the 'kind' name for the pencils] while listing the contents of the desk: say " (in which have been forlornly left [list of things which are in the pencil cup])"

I can’t seem to get it to do what I want. I guess it’s all about the idea of ‘containment’. Instead of ‘desk’ I used ‘room’, but that didn’t work either, I think it put the phrase before each pencil name. Next I think I’m going to try–

Rule for printing the name of the pencil cup: omit contents in listing; if there is something in the pencil cup: if there are at least two things in the pencil cup: say ", in which have been forlornly left [a list of things which are in the pencil cup]"; otherwise: say ", in which has been forlornly left [a list of things which are in the pencil cup]";

Would this work…??

It did work. But I had to remember to type 'say “tall cup, in which…”, and add another line or two, for the case when the cup was empty–the whole routine—

Rule for printing the name of the pencil cup: omit contents in listing; if there is something in the pencil cup: if there are at least two things in the pencil cup: say "tall cup, in which have been forlornly left [a list of things which are in the pencil cup]"; otherwise: say "tall cup, in which has been forlornly left [a list of things which are in the pencil cup]"; otherwise: say "tall cup".

But is there a better way to do this? This routine eliminates the parentheses, which I like.

More specifically, how can I control what is written inside the parentheses (if I want them) when the contents of something(sitting on something else) are being listed in a room description…?? I guess I can just include the parentheses while using the same routine I came up with above…??

Thanks

I’d say your way is reasonable. But be aware that you’re opening up a can of worms. Listing items correctly is complicated, particularly with regard to punctuation. (Inform’s parentheses duck some of these problems.) For instance, here’s something that could go wrong:

The Office is a room. The desk is a scenery supporter in the office. 
The pencil holder is a container on the desk. The blue pencil and the short pencil are in the pencil holder.
The Encyclopedia Britannica is a thing with indefinite article "the". It is on the desk. 

For printing the name of the pencil holder: 
	omit contents in listing;
	let N be the number of things in the pencil holder;
	say "tall cup[if N is not 0], in which [regarding N][are] [a list of things in the pencil holder]".

Check out the extension Tailored Room Description by Emily Short (in the Public Library). From the blurb: “Parenthetical remarks such as (open) and (in which are…) are omitted in favor of full English sentences.”

Thanks, JRB, I see what you mean. I organized the ‘contents’ of the desk, so that the pencil cup would be mentioned last, but that is a condition that is easily thwarted by player activity. But not without some amusement–I’m sure having a volume of the Britannica in a pencil cup would raise eyebrows.