Listing the contents

Hello, all:

When examining a copy of the game Operation in my story, the player gets the following description:

In an old-time game of Operation are liver, lungs, spleen, gall bladder, eyebrow, heart, tooth, uterus, hair, throat, cheek, head, shoulder, knee, toes, elbow, tongue, mouth, lips, nose and fingers.

I would like the display to say "In an old-time game of Operation are several puzzle pieces: "

I coded it this way but it will not compile:

rule for printing the contents of operation game :
	say "The old-time game of Operation contains several puzzle pieces:  ";
	list the contents.

Your help is appreciated!

1 Like

Assuming it’s defined as “operation game” in your code, try this:

Before listing the contents of operation game: say "The old-time game of Operation contains several puzzle pieces: [no line break]";

EDIT: Changed the code slightly.

1 Like

So close! So I compiled the code like this:

Before listing contents of operation game:
	say "The old-time game of Operation contains several puzzle pieces: [no line break]";

now the output of the description is:

In an old-time game of Operation The old-time game of Operation contains several puzzle pieces: are liver, lungs, spleen, gall bladder, eyebrow, heart, tooth, uterus, hair, throat, cheek, head, shoulder, knee, toes, elbow, tongue, mouth, lips, nose and fingers.

Which has the extraneous phrase beginning the list.

1 Like

It looks like the problem is the examine/search containers rule. Try this instead:

The examine containers rule does nothing when the noun is operation game. The standard search containers rule does nothing when the noun is operation game.

Carry out examining operation game (this is the special examine operation game rule):
	if something described which is not scenery is in the noun and something which is not the player is in the noun:
				say "The old-time game of Operation contains several puzzle pieces: " (A);
				list the contents of the noun, as a sentence, tersely, not listing concealed items;
				say ".";
				now examine text printed is true;
			otherwise if examine text printed is false:
				if the player is in the noun:
					make no decision;
				say "[The noun] [are] empty." (B);
				now examine text printed is true;

Report searching operation game (this is the customized search operation game rule):
	if the noun contains a described thing which is not scenery:
		say "The old-time game of Operation contains several puzzle pieces: " (A);
		list the contents of the noun, as a sentence, tersely, not listing concealed items;
		say ".";
	otherwise:
		say "[The noun] [are] empty." (B).

This code is just adapted from the standard rules, and it may need to be finessed a bit more if it’s possible for less than two things to be inside the game at a time.

Thank you for your help!

1 Like