# [I7] Examining multiple persons

Hi,

I have a room with 10 Miners. I want a way to examine them with one command and get a list of each miners description.

``````"Mining"

A Miner is a kind of person. A Miner is either on break, on his way to work or working. A Miner is usually working.

A Mine is a kind of room.
Mining Section A is a Mine. "A gold mine."

There are 10 Miners in Mining Section A.

Instead of examining someone:
if person is a Miner (called worker):
if worker is on break:
say "[one of]He looks at you like you don't belong here[or]He's eating a brownish looking nutrient paste[or]Behind all the dirt there appears to be a face[at random].";
otherwise if worker is working:
say "He's doing what he is supposed to do: he mines!";
otherwise:
say "He's on his way back to work.";

When play begins:
repeat with R running through rooms:
repeat with M running through each person in R:
if M is a Miner:
if a random chance of 1 in 2 succeeds and M is working:
now M is on break;

Understand "examine [things]" as examining.

[
Carry out looking at a group:
repeat with P running through each person in noun:
try examining P;

Understand "look at [things]" as looking at a group;
]

TEST ME with "examine miners"
``````

But this version seems to pick one miner, looking up his state and then prints either 10 descriptions for a working miner or 10 descriptions for a miner who is on his break. Like this:

``````>[1] examine miners
Miner: He's doing what he is supposed to do: he mines!
Miner: He's doing what he is supposed to do: he mines!
Miner: He's doing what he is supposed to do: he mines!
Miner: He's doing what he is supposed to do: he mines!
Miner: He's doing what he is supposed to do: he mines!
Miner: He's doing what he is supposed to do: he mines!
Miner: He's doing what he is supposed to do: he mines!
Miner: He's doing what he is supposed to do: he mines!
Miner: He's doing what he is supposed to do: he mines!
Miner: He's doing what he is supposed to do: he mines!
``````
``````>[1] examine miners
Miner: He's eating a brownish looking nutrient paste.
Miner: Behind all the dirt there appears to be a face.
Miner: He's eating a brownish looking nutrient paste.
Miner: Behind all the dirt there appears to be a face.
Miner: He looks at you like you don't belong here.
Miner: Behind all the dirt there appears to be a face.
Miner: He looks at you like you don't belong here.
Miner: Behind all the dirt there appears to be a face.
Miner: He looks at you like you don't belong here.
Miner: He's eating a brownish looking nutrient paste.

``````

The expected result would be to see some descriptions of a working miner and some of a miner on his break. I tested the random assignment and it is working correctly.

I tried a few other approaches (one example left in a comment block) but all result in even more of a mess.

This is just one of those â€śI keep looking at it and it looks rightâ€ť but it isnâ€™t things. Trust me, it happens to all of us!

``````Instead of examining someone:
if the noun is a Miner (called worker):
``````

â€śthe nounâ€ť, not â€śpersonâ€ť.

Inform reads â€śpersonâ€ť as â€śa personâ€ť and just randomly picks one.

2 Likes

Wow thanks. The last place iâ€™d have looked for the problem

You can (and should) also combine the condition into the rule heading itself:

``````Instead of examining a Miner (called worker):
``````

This will prevent the rule triggering on someone other than a miner, which would (as written above) result in aborting the standard examining rules without printing anything (since itâ€™s an Instead rule, which stops the action by default).

Itâ€™s possible to fix that inside general rules that have internal conditions, but itâ€™s better to use more specific rules.

4 Likes