Asking someone to do something ... in another language

How would you implement a person who will obey your commands, but only when you speak in her language?

For instance, if you say NINA, GLOBT SWONK, she’ll interpret that as NINA, GET SWORD… But if you type GLOBT SWONK yourself, the parser should say, “Wha?”

This is interesting, because you can’t use “Understand” rules with conditions based on the actor, since the actor isn’t known yet at the time the grammar is parsed. However, by the time you get around to running action rules, the player’s command has already been converted to an abstract object representation not relying on the original vocabulary.

Here’s one approach to solving this, which relies on setting the “active language” at the time of parsing, and then using rules to only allow actions by actors who speak the active language. This would allow for any number of languages, and for actors to speak multiple languages, although it wouldn’t account for the possibility of mixing words from various languages in a single command.

The Linguist Institute is a room. The Linguannex is east of the institute.

Zora is a woman in the institute. There is an apple in the institute.

A language is a kind of value. The languages are English, Zubian, and Perplexish.

Speaking relates various people to various languages. The verb to speak (he speaks, they speak, he spoke, it is spoken, he is speaking) implies the speaking relation.

The player speaks English. Zora speaks Zubian.

Persuasion rule: persuasion succeeds.

Understand the command "globt" as "go". Understand the command "zerk" as "examine". Understand the command "grurb" as "take".

Understand "swonk" as the apple. Understand "furb" as yourself. Understand "glik" as east.

Understand "globt/zerk/grurb/swonk/furb/glik" as "[Zubian vocabulary]".

The active language is a language variable.

After reading a command:
	if the player's command includes "[Zubian vocabulary]":
		now the active language is Zubian;
	otherwise:
		now the active language is English.
		
Before doing anything when the player does not speak the active language: instead say "Wha?".

Persuasion rule for asking people to try doing anything when the actor does not speak the active language: say "[The actor] just looks confused.";  persuasion fails.
	
test me with "grurb swonk / zora, grurb swonk / zora, go east / zora, globt glik / glik / east".

That’s a pretty ingenious solution. And fast, too! I’m glad I didn’t try to tackle that myself; clearly I don’t know enough about Inform’s parsing sequence. I would’ve frustrated myself.

Now I just implement some rules so if your command to Zora has a known verb, but the object is in question (because it’s not visible, because it’s not available, or whatever) she can try that verb randomly on some other item, and ask you quizzically if that’s the object you really meant. :slight_smile:

Aaron, will your solution let “zora, go glik” through? Preventing that might require a more annoying check – the way I can think of to do it would be to convert the command to indexed test, clip every name and everything that is in the active language, and see whether any letters are left. But that seems awful in any number of ways. (Or you could let “zora, go glik” through.)

Well,

Understand “lo siento” as saying sorry when the person asked is Maurice.

is a start. I wrote extensively about this at Verb Definition Based on Actor - #3 by Ron_Newcomb so sorry for the late reply.