How do I change the listing of a container in the room description? Standard is “In the container are an object1 and an object2.”. I want this to be “Littered over the container are an object1 and an object2.”. Thanks!
oops! that’s not right…
I thought I knew but I don’t. Looking forward to the answer!
lab is a room.
The box is a container in the lab
There is a red ball and a blue ball in the box.
Rule for writing a paragraph about the box:
say "You see [the list of things contained by the box] littered about in the box.";
Oh, sorry. Your solution indeed works, for the room description. I forgot to mention that I wanted something to work for when I examine an object. Sorry! Maybe I just need a code snippet for “if there’s something within the object” so that I can add it to the object description? Like "The object looks good.[if there’s something within the object] Littered about the object is [the list of things contained by the object].[end if]?
Try this:
"Untitled2" by Philip Riley
lab is a room.
The box is a container in the lab
There is a red ball and a blue ball in the box.
Rule for writing a paragraph about the box:
say "You see [the list of things contained by the box] littered about in the box.";
The description of the box is "[if the box contains nothing]You see a boring empty box[otherwise]You see [the list of things contained by the box] littered about in the box[end if]."
The examine containers rule does nothing when the noun is the box.
The tricky part is that the description of the box is printed separately from the contents of the box, so we need to turn off the contents description.
heheh. I was making it too complicated:
"Untitled2" by Philip Riley
lab is a room.
The box is a container in the lab
There is a red ball and a blue ball in the box.
Rule for writing a paragraph about the box:
say "You see [the list of things contained by the box] littered about in the box.";
Instead of examining the box:
say "[if the box contains nothing]You see a boring empty box[otherwise]You see [the list of things contained by the box] littered about in the box[end if]."
Works! Thanks!!
For general information, if the box contains nothing
is surprisingly slow if your game has a large number of objects and you have a lot of rules testing for emptiness. It may never be all that relevant for your game if those things don’t apply, but there’s not really any downside to making a habit of using:
definition: a thing is empty if the first thing held by it is nothing.
[...]
if the box is empty [...]
This will work for containers, supporters, and people: people would be “empty” if they were neither carrying nor wearing anything. ([value of kind K] is empty
would be true for any K that is a kind or subkind of thing but not a kind or subkind of container, supporter, or person.)