Asking an NPC to examine something

I don’t know if I’m just tired, or if I’ve run into a bug here. This is what happens in the story window:

[code]Example location
You can see NPC and a rock here.

actions
Actions listing on.

npc, examine
What do you want NPC to examine?

the rock
[answering NPC that “examine the rock”]
There is no reply.
[answering NPC that “examine the rock” - succeeded]

npc, examine rock
[answering NPC that “examine rock”]
There is no reply.
[answering NPC that “examine rock” - succeeded][/code]

Why does the examining action turn into “answering that”, when it’s obviously recognizing it at first (when asking which thing)?

The source code is very simple for demonstration purposes; just declaring NPC as a person, the cover-all persuasion rule “A persuasion rule for asking NPC to try doing something: rule succeeds”, the location, and the rock.

It works for me. I think the asking action has to happen to communicate to the NPC and can be blocked by any rules concerning that.

I note that your action is “answering it that” and mine is “asking”. Do you have some kind of conversation system possibly redirecting the asking action in the background?

[code]Meadow is a Room.

NPC is a person in meadow.
There is a rock in meadow.
A persuasion rule: persuasion succeeds.[/code]

You’re right, that does work. I tried it again just now. The thing is, in my original project, the NPC is part of something in the location (for story reasons), which I now realize is what causes this. Why it didn’t work when I changed that aspect in the clean test project, I have no idea. Maybe the story window bugged and showed me the same story over and over?

Thanks for the help! Now for figuring out why examine turns to “answering that” when the NPC is part of something :stuck_out_tongue:

EDIT: I made a container part of the thing, instead, and put the NPC in that. It seems to be just what I needed. Problem solved!

Hm! I wonder if NPCs are even technically allowed to be part of something under the hood?

I think that’s what “inanimate listeners” are for.

NPCs can be part of something–this was at the root of one of my early attempts to hack up a multiple commands extension, where I had a person that was part of a backdrop. See here and here.

From that experience I can answer this:

Now for figuring out why examine turns to "answering that" when the NPC is part of something

The reason this happens is that, if the NPC is part of something, the rock won’t be in scope for the NPC. So it’s as if you had typed “NPC, examine ahtapionv.” Then, when processing a conversation command, the parser first tries to parse it as a command (if the first word after the comma is a verb), and if it hits a parser error, it just turns it into an “answering it that command.” So:

[code]Cave is a room. An NPC is a person in Cave. A rock is in Cave. The player holds a present.

Rule for deciding the concealed possessions of the player: if the particular possession is the present, yes.[/code]

As you can see, “npc, x rock” got processed as an action, but the rest all got translated into answering it that–whether there was too much stuff in the command “x rock and roll,” nonsense “x fluffy,” or just something the NPC couldn’t see “x present.”

Oh, I see! Thanks for explaining, Matt! It seems obvious in hindsight that it was a scope problem. I never knew it automatically parsed a failed NPC action request as an answer. It kinda makes you wish that the actions listing output said something like “[noun is out of scope - answering NPC that “x rock” instead]”.

I realised, after reading your old posts you linked to, that this little snippet solves the problem:

After deciding the scope of NPC: repeat with thing running through visible things in the location of NPC: place the thing in scope.