Npc, give something

Hey All–

I have a conversation system where you can TALK TO NPC about keywords. But I also want the PC to able able to ask an NPC to give them something. And there’s surprisingly little I can find in the docs about “telling someone to try doing something,” which I think is the basis for commands like “DOG, GIVE BALL.” But I’m not sure that’s even correct, because I can’t even find a section that discusses this, just some examples that aren’t the same as mine. In my case, you want to ask people for a thing that is not visible, so it needs to be a text token instead of an object. The following code compiles:

Instead of asking someone to try doing something:
	if the noun is Grandma:
		if the player's command includes "give" and the player's command includes "love":
			say "Grandma says, 'Ugh.'";
	     otherwise:
		     say "You can TALK TO someone about a topic like another person or an object. You can also ask someone for something by typing MOM, GIVE FORK.".

but if you type GRANDMA, GIVE LOVE, all you get is “There is no reply.(which is actually a really appropriate mean answer)” You can tell Grandma to do a lot of weird stuff and get “There is no reply,” but weirdly, saying something like GRANDMA, GO WEST yields a blank reply here. So I think I’m on the wrong path?

I found this thread, so I tried various permutations of the “persuasion rule for asking grandma” thing, but no dice there either.

I don’t know why I’m having such trouble finding basic information on this.

Also open to better ideas generally about how to talk about things and ask for things, but shut down any other conversational stuff.

ETA: Also tried stuff with “Instead of asking someone for something.” Only get “There is no reply” no matter what I do.

If you give a command to an NPC, and that command triggers a parser error, then instead of showing the error to the player, the parser converts it into an “answering it that” action. (In other words, it assumes that GRANDMA, ASDFGHJKL is your character in the game saying something nonsensical, rather than you the player saying something nonsensical, and gives it to Grandma to answer instead of rejecting the command.)

So if you want to do your own special parsing of things players say to NPCs, you can put it in an “instead of answering Grandma that [whatever]” rule.

In this case, though, I don’t think you really want to reimplement the parser here. You can just define a new action:

Offering is an action applying to one text.
Understand "give [text]" as offering.
Instead of Grandma offering "love":
2 Likes

Thanks! But, Hmm. I get this message when I use that code:

Problem. You wrote ‘Instead of Grandma offering “love”’ , which seems to introduce a rule taking effect only if the action is ‘Grandma offering “love”’. But that did not make sense as a description of an action. I am unable to place this rule into any rulebook.

See the manual: 7.1 > 7.1. Actions

Because of this problem, the source could not be translated into a working game. (Correct the source text to remove the difficulty and click on Go once again.)

Always such helpful links Inform gives. Is there something else I should be doing?

And where in hell do I find documentation about this generally?

Also, to be rageful at Inform a little more, there’s NOTHING in the docs about this as a parser error. Zip, zero, nada.The only place I can even locate it as a parser error to know anything about it at all is in Zed’s standard rules page. WTF?

Some thoughts that almost work.

"Giving"

Lab is a room.  Grandma is a woman in the lab.

The ball is a thing.  Grandma holds the ball.

A persuasion rule for asking Grandma to try giving something to someone:
	now the second noun is the player;
	persuasion succeeds.

Instead of Grandma giving the ball to the player:
	say "Grandma hands you the ball.";
	now the player carries the ball;
	rule succeeds.

I think having Grandma hold whatever can be asked for might be a way to deal with the scope issue. Grandma can hold things and then they can referenced normally. (However >TAKE BALL will yield a default response of “That seems to be Grandma’s.”)

The only weirdness here is that in >GRANDMA, GIVE BALL, Inform will presume that Grandma should give the ball to Grandma (and report the inference as such). I tried fiddling with “rule for supplying a missing second noun” for a bit, but couldn’t get anything to work. (Specifically, phrases like “if actor is player” don’t appear to work inside such a structure.) >GRANDMA, GIVE ME BALL works as intended.

This only works if all the “give” topics can reasonably expected to be tangible things grandma could hold, though. Not sure if that’s the case here.

1 Like

Well, shoot. I can’t have that. The idea is that you ask, but nobody will give it to you, and often you can’t even see it, because they’ve hidden it somewhere or lost it. But you will get a clue. I could do all this with just TALK ABOUT BALL, but it seems reasonable that players would ask for it, and of course this seemingly simple coding turns out to be a big deal.

You could try some cleverness with the descriptions, perhaps. >X BALL yields “That’s what you’re trying to find! Now where is it?” even though Grandma is technically holding it, and >TAKE BALL yields something similar. And of course, Grandma doesn’t have to give the ball. But of course this can wind up getting convoluted quickly.

2 Likes

This actually sounds like a job for Eric Eve’s “Conversation Responses” extension which adds (among other useful things) the mechanics for this grammar:

Response of Bob when asked for the wallet

Response of Bob when asked for sympathy

3 Likes

I resist extensions because then I don’t learn. But if this is just too hairy, we can all have another cringe thread where I try to install an extension and Wade patiently rescues me.

1 Like

That’s because I made a stupid mistake. Try this.

The Lab is a room. Grandma is a woman in the Lab.

Offering is an action applying to one topic. Understand "give [text]" as offering.
Carry out an actor offering: say "Offering [topic understood]."

Persuasion: persuasion succeeds.
Carry out Grandma offering "love":
	say "She has plenty of love to give.".

Test me with "grandma, give love".
2 Likes

At minimum, you could mine his extension for the code that makes it work.

2 Likes

That worked great, minus the “Carry out an actor offering” line, which runs before the specific grandma offering line.

Thanks! I had no idea you could do this with other people. Mind 'sploded.

Yeah, the really obnoxious part is that you can’t use Instead rules easily for this, because they’ll print an additional “Grandma is unable to do that”. This comes from the “unsuccessful attempt” rules, which run whenever you ask an NPC to do something, and the action gets stopped before the Carry Out stage.

So if you want to use Instead rules you also need to write an Unsuccessful Attempt rule that overrides the default one, and it’s a huge pain overall.

1 Like