Thanks Felix, matt w and capmikee!
Firstly, bother! I didn’t get an E-mail notification to say that anyone had appended this thread, so I went ahead and experimented and ultimately I was satisfied with this code:
[code]A WorkGarment is a kind of thing. A Shirt is a kind of WorkGarment. The indefinite article is “a”. Dungaries are a kind of WorkGarment. The indefinite article is “some”. Boots are a kind of WorkGarment. The indefinite article is “a pair of”.
A left wrist is a kind of thing. A right wrist is a kind of thing.
A labourer is a kind of person. A left wrist is a part of every labourer. A right wrist is a part of every labourer.
In the construction site is a male labourer called Tom. The printed name of Tom is “Tommy”. Tom is wearing a shirt called Tom’s shirt. He wears some dungaries called Tom’s dungaries. He wears some boots called Tom’s boots. ] To say rundown for (somebody - Tom): say “[if Tom is In WorkGear]Muscle man Tommy is here, in grubby work clothes[Else]Off-duty Tom is here, wearing [a list of things worn by Tom]”. The description of Tom is “[rundown for Tom]”.
[~~~ And then repeated for the other two labourers ~~~]
[/code]
I didn’t know about the gramar “Every person incorporates” though. Thanks matt w, that helps streamline a lot of code! Eg: “Every labourer incorporates a left wrist and a right wrist.”
Now out of curiosity I tried it this way as suggested by Felix:
Every construction worker wears a shirt. Every construction worker wears dungaries. Every construction worker wears boots.
And yes, as Felix warned it does produce identically named objects. That’s not necessarily a problem in my game though, because the next puzzle in my (little) game was to persuade the night watchman to open up the suspect’s work locker (or maybe pick the lock). Thus each set of work gear is separated (unless the player is stupid enough to mix them up.) There’s also a possibility that I’d do a replace of the ordinary shirt with a separate one that has the bloodstain and give that shirt it a different name.
Something I would need to know then, is how to write code for an NPC to pick up and put down objets (the game orchestrating so, not the player). I haven’t had much luck there. I’ve tried “Now [NPC Name] carries” to pick up and “Now the [noun] is in the locker” but it doesn’t always work, and I’m not understanding the cause of the problem. Plus if the objects are identically named that makes it even more tricky to manipulate a particular object.
Where do I find examples of the coding to make NPCs pick up / put down?
Matt W, I’ve put your code in a separate project and yes it compiles and runs very effectively. Am I right in assuming that these two lines of code are what enables Inform to deduce which noun the player is referring to?
Understand "[something related by reversed enclosure] 's" as a thing.
Understand "my" as a thing when the player encloses the item described.
How do these work? I haven’t done much with the concept of enclosure. What is the function of “related by reversed enclosure” ?
Also, how does the below code work?
After reading a command:
let X be indexed text;
let X be the player's command;
replace the text "'s" in X with " [']s";
change the text of the player's command to X;
say "[line break]".
Am I right in reading that this block of code puts square brackets around apostrophes? Effectively what is the goal/outcome of this?
I look forward to seeing the replies in this thread. It would be good to have a standardised extension created for describing NPCs. Goodness knows they’re used often enough in Interactive Fiction.