identifying people in a location

I want to respond to different cases: (1) the location is empty (except for the player); (2) Someone in the location is not Ganon; (3) Ganon is in the location.
I’m having trouble phrasing this correctly. It doesn’t even recognize the gender of the person; I thought that was built in. Here is some of my incorrect code.

Instead of banking when location is not Loan Office:
	if only the player is in the location:
		say "To whom are you talking? There is no one here that does banking." instead;
	if a person who is not Ganon and who is not the player is in location:
		say " 'You'll want to talk to Ganon in the Emporium about that.' " instead;
	if Ganon is in location:
		say "Ganon says, 'All banking business is done in my Office. Do you have any banking business?' ";

The player being a person complicates things a lot. If I check for a person, the player is always there. Is there a general way to exclude the player from a person check?

For “only the player”, I think this is the best approach:

Definition: a person is alone if the number of people in the location of the person is 1.

Then you can write if the player is alone:

For the second case, I think this might work:

Definition: a person is other if it is not the player.

And then you might be able to write if an other person except Ganon is in the location:. But I’m not sure if except is actually recognized in that context. I know it is recognized in some contexts, but not sure that’s one of them.

Another possibility for case 2 might be to include the Alternatives extension (I forget who it was by). Then you might be able to write if a person who is neither Ganon nor the player is in the location: or if anyone in the location is neither Ganon nor the player:. Again though, I’m not certain it works in those specific contexts, as “neither…nor” is a boolean phrase, and we’re working with descriptions here.

A third possibility is to just invent an adjective for it.

Definition: a person is bystander if it is not Ganon and it is not the player.

Then just write if a bystander is in the location:. Might need to be if a bystander person is in the location:.

1 Like

@Celtic_Minstrel 's covered a lot.

For my ‘other’ definition, I do like to say ‘non-player’ just so it reads more easily in code.

Definition: a person is non-player if it is not the player.

If a non-player person is in the location...

etc.

-Wade

For what it’s worth, I choose “other” because that makes it flow like natural English. I also define “another” as a synonym for the same reason.

Yeah, I generally have both “other” and “another” mean “not the player”. It tends to read very nicely. But “non-player” is also a perfectly fine adjective for it.

I sometimes go with:

Definition: a person is an NPC if it is not the player.

Could it ever be the case that both Ganon and a non-Ganon NPC are there at the same time?

Wow! Thanks guys! This is a lot of good info. I will try this out and let you know.
btw, Iron ChIF, yes, Ganon can be in a location with other NPCs.

I can’t get these definitions to compile. It is complaining that ‘person’ is not specific enough.

I got this statement to compile by removing the “of the player”

Definition: A person is alone if the number of people in the location is 1. 

Okay. I got this code to work. It is a meld of many of the ideas all of you presented.

Definition: A person is alone if the number of people in the location is 1. 
Definition: A person is NPC if it is not the player. 

[A synonym for any of the Loan Office services]
Instead of banking when location is not Loan Office:
	if player is alone in the location:
		say "To whom are you talking? There is no one here that does banking." instead;
	otherwise:
		let P be a random NPC in location;
		if P is not Ganon:
			say " [Printed name of P] says, 'You'll want to talk to Ganon in the Emporium about that.' " instead;
	if Ganon is in location:
		say "Ganon says, 'All banking business is done in my Office. Do you have any banking business?' ";

Should be in the location of it. I made the common mistake of using a noun as a pronoun, which Inform can’t understand.

Without that clause, it’ll only work for the player. You won’t be able to check if an offscreen NPC is alone.

Interesting. I’ll check on that. I’m not sure I’ll need to check a generic NPC. I usually know which NPC by name whether they are alone or not.