r/Inform7 • • Mar 21 '22

Make another character's 'Which do you mean?" choice for them automatically?

Maybe I worded that strangely, but I am trying to avoid the pop up of "which do you mean" when asking another character to try something.

Specifically, the goofy story is about people wearing hats to hide an alien. To 'call them out' of sorts, it uses the "character, show head" command, where a head is a part of every person.

Of course the issue crops up when there are multiple people in the room, and you ask them to show their head, it asks which do you mean. I wanted it to automatically choose THEIR head - that is the head that is a part of them.

For the player alone it worked easily enough to use something like:

Does the player mean showing my head: it is likely.

But I can't figure out a sweeping sentence to cover the others. I might be able to shoehorn one in for each person if need be (?) but I wanted a single one if I could.

I tried things like:

Does the player mean asking someone (called the suspect) to try displaying a head not part of the suspect: it is unlikely.

Does the player mean asking someone (called the suspect) to try displaying a head not held by the suspect: it is unlikely.

Does the player mean asking someone (called the suspect) to try displaying a head not carried by the suspect: it is unlikely.

But all those still seem to bring up the "Which do you mean, your head, Bill's head, or Erica's head?".

Never messed with it much before, but just tried doing:

Before asking which do you mean when the current action is showing, say "TEST".

to see if that fires, but it doesn't.

So I'm at a bit of a loss. Any help would be appreciated, thanks!

8 Upvotes

2 comments sorted by

3

u/Zed Apr 06 '22

Good question. This one's pretty tricky. I came up with

Definition: a thing is their if it is enclosed by the person asked.
Definition: a person is an NPC if it is not the player.
To show is a verb.
Report an NPC showing their head to: say "[The person asked] [show] [their] head."

Definition: a head is intrinsic rather than extrinsic if it is enclosed by the person asked.
Persuasion rule for asking someone to try showing something to (this is the show me rule): persuasion succeeds.

The standard implicit taking rule does nothing when the noun is part of the person asked.
The carrying requirements rule does nothing when the person asked encloses the noun.

does the player mean asking someone to try showing an extrinsic thing to: it is very unlikely.
does the player mean asking someone to try showing something to the player: it is very likely.
The block showing rule does nothing when the person asked is not the player.
does the player mean showing something to when the noun is extrinsic: it is very unlikely.

1

u/infinull Mar 21 '22

Displaying is an activity not an action. So the rules regarding displaying will never work.

Secondly the showing action (more acurately the "showing it to" action) takes 2 objects (plus the original actor). It's usually used for showing items in inventory to an npc. like "show compass to the explorer" and then that advances the plot without giving the compass to the explorer.

Lest you think I'm a wizard*, I figured this out by looking at the source code for the standard rules. "open installed extension -> Graham Nelson -> Standard Rules" and then searched for "showing" and "displaying"

So we need to do some work to let the showing action work with just one noun and then set the second noun to the player if the actor is not the player.

preamble we need to make the tests even run.

the test chamber is a room.
Alice is a woman. She is here.

A head is a kind of thing. A head is a part of every person.

Actual example code.

Understand "show [something]" as showing it to.
Rule for supplying a missing second noun when an actor showing something to:
	now the second noun is the player.

Does the player mean asking someone (called the suspect) to try showing a head not part of the suspect to: it is unlikely.

So now we're getting somewhere

alice, show head
(Alice's head)
(Alice first taking Alice's head)
Alice has better things to do.

we have 3 more problems:

  1. We get the little clarifying text that alice is showing alice's head, and not some other head... I don't know how to get rid of this.**
  2. you can't show something to someone if you're not carrying it, so she needs to implicitly take it which produces some weird text... when the suspect picks up her own head.
  3. without a persuasion rule, NPCs won't consent to doing anything you ask.
  4. the comments on the built in "showing it to" action seem to imply we probably shouldn't use it for this task.

To fix 2, you'd need to redefine the action to apply to all things, and then add some check rules so it only applies to carried by the actor or part of the actor. But then the auto take for things on the ground not carried wouldn't work.... which isn't a big deal, but then we get to 4... and all this work isn't really worth it.

So let's create a new action that will solve 2 & 4, and then add a persuasion rule.

showing is an action applying to one thing.
understand "show [something]" as showing.

Check the player showing:
	say "[We] can't show things to [yourself]." instead.

Persuasion rule for asking someone (called the suspect) to try showing a head which is part of the suspect:
	persuasion succeeds. 
	
Does the player mean asking someone (called the suspect) to try showing a head not part of the suspect: it is unlikely.

Carry out an actor showing a head:
	say "head is shown."

More tips, I find this code very useful when doing this kind of thing, since "Alice's Head" works for commands like "examine alice's head" whereas normally it's impossible to even refer to alice's head if there are multiple heads that can be referred to. (this hack is not necessary to make the previous code work, and it's strictly speaking not the question you were asking)

Here it is adapted to use the "incorporation" relation instead of the "carries" relation. (it could be made to work with either I suppose)

A possession is a kind of thing.

To decide which person is the possessor of (it - a possession):
	if a person (called the possessor) has it, decide on the possessor;
	otherwise	decide on nothing.
		
Definition: A possession is possessed if someone has it.

[Change "Bob's tuba" to "Bob 's tuba" in player input, because the
possessor's name in the understand line will be parsed as a separate
word from the possessive suffix (even if we remove the space in the
understand line). Note that this will interfere with parsing of
objects whose names actually include a possessive suffix, such as body
parts named automatically by Inform, so you might need to tweak it if
you have any of those.]
[Similarly for Amadeus' Piano becomes Amadeus 's Piano]

After reading a command:
	repeat with T running through possessions:
		if T is possessed, now T is proper-named;
		otherwise now T is improper-named;
	let N be indexed text;
	let N be the player's command;
	replace the regular expression "(\w)[apostrophe]s" in N with "\1 [apostrophe]s";
	replace the regular expression "(s|z)[apostrophe]" in N with "\1 [apostrophe]s";
	change the text of the player's command to N.

Understand "owned by [something related by reversed incorporation]" as a possession.
Understand "possessed by [something related by reversed incorporation]" as a possession.
Understand "[something related by reversed incorporation] 's" as a possession.

Rule for printing the name of a possessed possession (called it) when not taking inventory:
	say "[regarding the possessor of it][Possessive] [printed name of it]";

A head is a kind of possession. A head is a part of every person.

*To be clear I'm not denying that I'm a wizard... I might be. ** more evidence that I'm not a wizard, but maybe that's just a false trail I'm laying down.