I’ve run into a couple of problems with a rule for printing the name of a person holding one or more objects. The rule I’ve got is:
Rule for printing the name of a person (called P) when P is holding an object:
let N be the printed name of P;
say "[the N] (holding [the list of objects held by P])".
This works alright if, say “a person (holding an apple)” walks into the room where the player is, but doesn’t read right if you see them pick up the object (since they’re described as already holding it at the point they take it) or if you see them holding more than one object (since it introduces a grammatical issue). Here’s an example of both problems, standing in a broom cupboard where a janitor picks up both a mop and a bucket:
Broom Cupboard
The Maintenance Room is north from here.
You can see a janitor, a mop and a bucket here.
The janitor (holding the mop) picks up the mop.
The janitor (holding the bucket and the mop) pick up the bucket.
Does anybody know a more reliable/convenient way of producing the result I want? Alternatively, is there a trick to delaying the “holding X/Y/Z” description until the next turn and suppressing the shift from “picks up” to “pick up” once there’s an “and” in the name? This feels like the sort of thing that there might even be an extension for, but search engines being what they are these days I’ve had no luck finding one.
Lab is a room.
Bob is a man in the Lab.
An apple is a portable thing in the Lab.
A banana is a portable thing in the Lab.
Persuasion: rule succeeds.
After printing the name of a person (called the subject):
if the current action is the subject taking, make no decision;
if the subject is not holding a thing, make no decision;
say " (holding [a list of things held by the subject])";
say regarding the subject. [Reset verb agreement]
Key points:
“After printing the name” instead of “rule for printing the name” ensures it doesn’t override other rules that might exist
Does not apply when the subject (the person being named) is taking something
Does not apply when the subject is not holding anything
You can also get a bit fancier with “if the current action is the subject taking a thing (called the item)” and omitting the item from the list. This is left as an exercise for the reader.
To be very conservative about this, you could limit the “(holding an apple)” addition to only appear during a Looking action. (And not during every-turn rules, if the NPC autonomously picks stuff up.)
Just noting that you may want to change holding an object and held by P to carrying an object and carried by P, respectively. Otherwise I’m pretty sure it’ll include clothing as well.
The other points regarding holding/carrying and restricting it to “looking” are worth keeping in mind too, but for this particular game I think this is the exact behaviour I want.