[I7] Global word for conversing

I have a character in my game who ignores everything you say. I want to replace the default response ‘There is no reply’ for all possible ways the player might try talking to the character.

E.g. This only works for TELL FRED ABOUT…

Instead of telling Fred about something, say "Rather rudely, Fred ignores you and continues searching for his hearing aid."

I’d like the same response for any normally-valid entries
ASK FRED ABOUT…
TELL FRED ABOUT…
FRED, HELLO
TALK TO FRED
SAY BOO TO FRED
etc.

I imagine there is a catch-all term covering all types of conversation but I haven’t been able to guess what it is. “Conversing” isn’t recognised, for example.

There isn’t a built-in catch-all term, but you can define a kind of action as in §7.15 of writing with Inform:

[code]Asking Fred about something is bothering Fred.
Telling Fred about something is bothering Fred.
Answering Fred that something is bothering Fred.

Instead of bothering Fred, say “message here.”[/code]

Note that “FRED, HELLO” and “SAY HELLO TO FRED” result in the same action, answering Fred that hello. (If you’re not sure what action a command is resulting in, you can type “actions” at the command prompt and then try the command.) Also, “TALK TO FRED” isn’t normally valid out of the box; you’d have to define a talking to action and then add it to the kind of action. Also also, you probably want to do something similar for asking Fred to do something like “FRED, GO WEST”; these can’t be taken care of in kinds of action but could be done with an “Unsuccessful attempt” rule as in §12.5 of Writing with Inform.

One last thing, the name of the kind of action is “bothering Fred”–you can’t take that definition and turn it into rules for “bothering Alice” or something like that. (It might as well be botheringFred, if that makes sense.) You could specialize the message for different characters by specifying the noun, if you want:

[code]Asking someone about something is bothering.
Telling someone about something is bothering.
Answering someone that something is bothering.

Instead of bothering when the noun is Fred, say “Fred message.”
Instead of bothering when the noun is Alice, say “Alice message.”[/code]

Thanks Matt.

Is there a way I can incorporate telling someone to do something? E.g. TELL FRED TO WAKE UP.

That’s a bit trickier. That syntax isn’t understood out of the box, and you probably would want it to convert to the equivalent of “FRED, WAKE UP,” which isn’t straightforward. It’s possible to hack that up (I’m fiddling with something right now), but if the only use you’ll have is to have Fred fiddle with his hearing aid, it’d be simpler to just catch it like this:

Understand "tell [someone] [text]" as telling it about.

Then “TELL FRED TO WAKE UP” will get processed as telling Fred about the topic “to wake up”–but since Fred ignores everything you say, it doesn’t really matter what the topic is. (This will still let “TELL FRED ABOUT APPLES” get processed as telling Fred about “apples”, in case that makes a difference.)

EDIT: For what it’s worth, this is what I was hacking up:

[spoiler][code]Lab is a room. Fred is a man in Lab. Alice is a woman in Lab.

Asking someone about something is bothering.
Telling someone about something is bothering.
Answering someone that something is bothering.

Instead of bothering when the noun is Fred, say “Fred message.”
Instead of bothering when the noun is Alice, say “Alice message.”

Understand “tell [someone] [text]” as telling it about.

Telling it to is an action applying to one thing and one topic. Understand “tell [someone] to [text]” as telling it to.

Converting a tell command is a truth state that varies. Command text is some text that varies. The commanded person is a person that varies.

Carry out telling it to when converting a tell command is false:
now converting a tell command is true;
now the commanded person is the noun;
now the command text is the substituted form of “[the topic understood]”.

For reading a command when converting a tell command is true:
now converting a tell command is false;
change the text of the player’s command to “[commanded person], [command text]”.[/code][/spoiler]

I would recommend caution before trying to use that.

Here’s a solution I came up with for TELL (someone) TO (do something), that I’ve tested in my WIP. It should also be approached with caution:

[code]Test Chamber is a room.

A man called Gordon is in the test chamber. The crate is an open container in the test chamber. The crowbar is in the test chamber.

Persuasion rule:
persuasion succeeds.

After reading a command (this is the phrase commands properly rule):
let N be “[the player’s command]”;
replace the regular expression “^(ask|tell|order) (.+?) to (.+)” in N with “\2, \3”;
change the text of the player’s command to N.

Test me with “ask gordon to take the crowbar / tell gordon to put the crowbar in the crate / order gordon to jump”.[/code]

This suffers from the common problem with trying to do action-parsing in an “after reading a command” rule:

EDIT: I forgot this pitfall:

I do not have a better solution on hand, though, I’m afraid.

Whoops, you’re right.

There are probably other pitfalls as well, but this should take care of the two that zarf found:

After reading a command (this is the phrase commands properly rule): let N be "[the player's command]"; replace the regular expression "(?i)(^|(.+?)(then|.))(ask|tell|order) (.+?) to (.+)" in N with "\1 \5, \6"; change the text of the player's command to N.

You’ll still have problems with constructions like ASK GORDON ABOUT HIS TRIP TO THE BEACH. But it’s probably a matter of which corner cases you’re willing to live with.

My version does seem to take care of those pitfalls.
“NORTH. TELL GORDON TO TAKE CROWBAR” gets processed as going north and then a telling it to action that gets turned into “GORDON, TAKE CROWBAR.”
“ASK GORDON ABOUT HIS TRIP TO THE BEACH” doesn’t get turned into a commanding action, because the part between “ask” and “to” doesn’t match the “[someone]” token.
“TELL GORDON TO TAKE CROWBAR. JUMP” does get converted into two commands to Gordon, to take the crowbar and then jump, but this is the same as the out-of-the-box behavior for “GORDON, TAKE CROWBAR. JUMP.” (It’s like “TELL GORDON TO TAKE THE CROWBAR THEN JUMP” which is ambiguous in English.)

zarf, I wasn’t sure what your “>TELL GORDON TO TAKE CROWBAR” pitfall was–that seemed to work OK in Mike’s code?

Anyway, here’s what I have for the test case. And I’m sure there are plenty of pitfalls there. (One thing is that it’ll surely break when “[commanded person]” results in text that can’t be understood or is ambiguous, but that’s a bad situation anyway.) I wouldn’t trust it much around disambiguation although this simple case seems to work.

[code]Test Chamber is a room.

A man called Gordon Freeman is in the test chamber. A man called Flash Gordon is in the test chamber. The crate is an open container in the test chamber. The crowbar is in the test chamber.

Persuasion rule:
persuasion succeeds.

Telling it to is an action applying to one thing and one topic. Understand “tell [someone] to [text]” as telling it to. Understand “ask [someone] to [text]” as telling it to. Understand “order [someone] to [text]” as telling it to.

Converting a tell command is a truth state that varies. Command text is some text that varies. The commanded person is a person that varies.

Carry out telling it to when converting a tell command is false:
now converting a tell command is true;
now the commanded person is the noun;
now the command text is the substituted form of “[the topic understood]”.

For reading a command when converting a tell command is true:
now converting a tell command is false;
change the text of the player’s command to “[commanded person], [command text]”.

Instead of telling Gordon Freeman about something: say “You say, ‘Did you know about [the topic understood]?’ Gordon says nothing, as usual.”

Test me with “ask freeman to take the crowbar / tell freeman to put the crowbar in the crate / order freeman to jump/ jump. tell freeman to take the crowbar/ ask freeman to drop the crowbar. jump/ tell freeman about my trip to the beach/tell gordon to x gordon/freeman”.[/code]

Probably works in Zcode, but the capital letters foil the regexp in Glulx. Mike’s second version fixed that by adding “(?i)”.

Ah, I see–I tend to type everything in lowercase anyway and forget it can make a difference with that sort of thing.

I second Matt’s solution. I’ve tried something like that before with a puzzle involving people relaying orders to each other: >ALICE, TELL BOB TO DO THE THING. Unfortunately never got it working in a satisfactory way.

There is an extension called “Conversational Defaults” by Eric Eve. The primary use is to set how an NPC responds when none of the other input matches. I think if you used this and gave your character a “Bob remains mute on the subject.” type default response with nothing else, that might do it for you.

Eric Eve’s extensions usually cover all the bases “tell about, ask for, ask about” although they use slightly modified verbs internally, so it’s worth a try. Hopefully, it wouldn’t goof up the rest of your conversation.

…as usual, no guarantee this won’t blow up in your face.

[code]Test Chamber is a room.

A man called Gordon Freeman is in the test chamber. A man called Flash Gordon is in the test chamber. The crate is an open container in the test chamber. The crowbar is in the test chamber.

Persuasion rule:
if the person asked is Gordon Freeman and the commanding person is not Flash Gordon:
say “Gordon Freeman won’t take orders from anyone but Flash Gordon.”;
persuasion fails;
persuasion succeeds.

Telling it to is an action applying to one thing and one topic. Understand “tell [someone] to [text]” as telling it to. Understand “ask [someone] to [text]” as telling it to. Understand “order [someone] to [text]” as telling it to.

Converting a tell command is a truth state that varies. Command text is some text that varies. The commanded person is a person that varies. The commanding person is a person that varies.

Carry out telling it to when converting a tell command is false:
now converting a tell command is true;
now the commanded person is the noun;
now the commanding person is the player;
now the command text is the substituted form of “[the topic understood]”.

Carry out someone telling:
now converting a tell command is true;
now the commanded person is the noun;
now the commanding person is the actor;
now the command text is the substituted form of “[the topic understood]”.

For reading a command when converting a tell command is true:
now converting a tell command is false;
change the text of the player’s command to “[commanded person], [command text]”.

Instead of telling Gordon Freeman about something: say “You say, ‘Did you know about [the topic understood]?’ Gordon says nothing, as usual.”

Test me with “ask gordon to take the crowbar /flash/ tell gordon to put the crowbar in the crate / flash/ order gordon to jump/flash/ jump. tell gordon to take the crowbar/ flash/ ask gordon to drop the crowbar. jump/ flash/ tell gordon about my trip to the beach/freeman”.

Test nested with “tell gordon freeman to get the crowbar/tell flash gordon to tell gordon freeman to get the crowbar”.

Test nested disambiguation with “tell gordon to tell gordon to get the crowbar/freeman/tell gordon to tell gordon to get the crowbar/flash”.[/code]