"You can't see any such thing" when showing or giving an animal to something inanimate

Showing an animal to something inanimate gives the message “You can’t see any such thing.”

Sample code:

Lab is a room.

A bird is an animal in Lab.

A pencil is in Lab.

A statue is in Lab.

Test me with "show bird to statue / show pencil to statue / give bird to statue / give pencil to statue".

Sample transcript:

Lab
You can see a bird, a pencil and a statue here.

>test me
(Testing.)

>[1] show bird to statue
You can't see any such thing.

>[2] show pencil to statue
You can only do that to something animate.

>[3] give bird to statue
You can't see any such thing.

>[4] give pencil to statue
You can only do that to something animate.

Is this a bug?

So far it seems like this happens in response to showing and giving, but I’m not sure what else.

To deal with this, I am thinking of using something along these lines:

Understand "show [something preferably held] to [something]" as showing it to.

Understand "give [something preferably held] to [something]" as giving it to.

Check showing something to something when the second noun is not a person:
	say "You can only do that to something animate." instead.
	
Instead of showing something to the statue:
	say "There is no response.".

It seems like once you add the understand lines, there’s already a built-in response for trying to give things to an inanimate object (“The statue isn’t able to receive things.”) and for showing to an inanimate object (“The statue is unimpressed.”), but I think I want to change the latter.

Do you basically just want the rules to act like the statue is a person even though it’s not?

If so, do you want that behavior generically (e.g. accept >SHOW BIRD TO PENCIL) or only to specially-designated objects?

I don’t want the statue to act like a person. Mostly I want to allow the player to attempt some actions that might make sense with a possibly-animate object, like giving and showing, and get graceful refusals that reflect that it’s not animate (something along the lines of “Nothing happens” rather than “The statue is unimpressed.”)

I’m uncertain if actions like these should be allowed to be attempted everywhere, on every inanimate object. On one hand, being told “You can’t see any such thing” is just plain misleading. On the other hand, I doubt many people are going to try things like showing birds to pencils anyway, and I’m not sure what other side effects might come about if I try to change the grammar everywhere (vs. having the attempt understood only in the location of the statue, for example, to try to minimize unforeseen side effects).

1 Like

Would you be able to change the rule response to what you wanted?

The reason that you get that error is that the grammar line uses a [someone] token. As an example for the giving it to action:

Understand "give [something preferably held] to [someone]" as giving it to.
Understand "give [someone] [something preferably held]" as giving it to (with nouns reversed).

When the parser is trying to match objects to the words in the player's command, the [someone] token invokes a routine called CreatureTest(). This is what it looks like in 6M62:

[ CreatureTest obj;
	if (obj has animate) rtrue;
	if (obj hasnt talkable) rfalse;
	if (action_to_be == ##Ask or ##Answer or ##Tell or ##AskFor) rtrue;
	rfalse;
];

Even though the parser will correctly match the word “statue” to the statue, the fact that the statue is not a person will cause it to fail the test, and the parser will proceed as though no object was recognized.

If you redefine the grammar for the giving it to action as you have, then the new grammar line that you provide will match to any thing, not just the statue.

There is an extension (included in Inform) called Inanimate Listeners by Emily Short. If you include that, you can assert:

The statue is addressable.

That still won’t be enough, however, because the logic of CreatureTest() limits its applicability to addressable things only in the context of certain actions. You will also need to modify the CreatureTest() routine to allow actions like giving it to or showing it to.

[ CreatureTest obj;
	if (obj has animate or talkable) rtrue;
	rfalse;
];

That version lets the [someone] token match to any addressable thing regardless of the action in question. Regular things will not match.

1 Like

Are there any obvious downsides to this?

The game will be less good at inferring a noun when there are several things available but only one of them is animate.

But you know how I feel about noun inference by now. I think it’s better to be able to customize the refusal message.

As I said in some other thread, this is a case where Inform does noun inference reliably out of the box. If you use an animate verb and there’s exactly one animate in the room:

>say hello
(to Fred)
There is no reply.

>give rock
(to Fred)
Fred doesn't seem interested.

>show
What do you want to show Fred?

Your game may not have that situation, but if it does, make sure you don’t screw that up.