I7: implicitly repeating through indexed texts

I want some things to have text associated with them and I want to use relations to do it. This is a distillation of my goal:

[code]The Storeroom is a room.

An adze is here.
An apple is here.

Translation relates various indexed texts to various things.
The verb to translate (it translates, it is translating, it is translated) implies the translation relation.

“adze”, “aisette”, and “Breitbeil” translate the adze.
“apple”, “pomme”, and “Apfel” translate the apple.

Instead of examining:
say “[list of indexed texts translating the noun in brace notation][paragraph break]”.

Instead of answering:
say “[list of things translated by the topic understood in brace notation][paragraph break]”.[/code]
This compiles, but upon examining anything, I get:

Upon answering anything, I get:

three times (once for each thing in the game).

How can I get around these two issues using relations? I would like to avoid “A thing has a list of indexed texts called the dictionary.” if possible.

Being an indexed text hater, I use kinds of value for this sort of thing.

I’ve had issues with creating lists of indexed text or whatever via relations like that. It’s one of the newest parts of Inform, and I don’t think the bugs are fully wrung out yet.

As Ron suggests, block value types like indexed texts have historically been buggier than others as new features have been added.

You might want to consider whether you need indexed texts at all; maybe a standard text would work? If your example reflects your actual code, there doesn’t appear to be much reason to use indexed texts (unless you wanted the player to be able to contribute her own translations). As a general rule, if you can specify the texts in advance or assemble them easily from other pieces, you don’t need indexed text.

–Erik

:laughing: :laughing: I’m with you here, Mike – both anti - indexed text and pro KOVs.

Gorobay, I’m assuming you’re using indexed text because nouns in German (“Apfel”) must be capitalized. What specifically are you trying to do? If all you need is a way to make sure the game’s output is correct, you can do this without indexed text. If you’re trying to enforce the correct capitalization on the player’s input (for example, making a game for language instruction) you will need indexed text to process the command, but not necessarily in the relation. (Also you’ll need to compile to Glulx, since player commands in z-code games are are case insensitive.) BTW, I tried your code with text instead of indexed text and it still doesn’t work.

Also, I’m curious as to why:

Here’s a minimal example of how you could use kinds of value for this:

[code]A word is a kind of value.

aisette, Breitbeil, pomme, and Apfel are words. [<-- note the capitalization]

Translation relates various words to various things.
The verb to translate (it translates, it is translating, it is translated) implies the translation relation.

Instead of examining:
say “[Noun] = [the list of words that translate the noun].”.

Word-saying is an action applying to one word.
Understand “say [word]” as word-saying.

Report word-saying:
say “[word understood] = [the list of things translated by the word understood].”.

The Storeroom is a room.

An adze is here.
An apple is here.

aisette and Breitbeil translate the adze.
pomme and Apfel translate the apple.

test me with “x adze / x apple / say pomme / say apfel / say aisette / say breitbeil”.[/code]
Note that the output is correctly capitalized, but the input capitalization is ignored. Also, I left out the English words from the KOV list, because Inform can get easily confused when you try to use the same word for both an object and a KOV. Both of these limitations can be worked around, but I didn’t want to clutter up the example since I’m not sure what precise behavior you’re after.

Elsewhere in my code I compare snippets to these texts, and I think that means I need indexed texts. If texts work too, are they better?

The code I gave above was just an example. My actual game has nothing to do with translations; it was just the first simple example I could think of. Specifically, I am cobbling together my own parser to deal with references to nonexistent but possible things, so I need to process the player’s input.

I would prefer to be able to say ““pomme” translates the apple.” in one part of the source, and ““Apfel” translates the apple.” in a different part. With a single property I would have to declare everything at once. If there is something that allows me to extend lists (e.g. "The thesaurus of the apple (extended) is {“manzana”}.) I would use that.

Skinny Mike, the code you posted looks useful; thank you. Is there a way I expand it to allow multiple words? I have tried “Word-saying is an action applying to words. Understand “say [words]” as word-saying.” but that does not seem to work.

I wouldn’t say that text is better per se, but a text does use fewer resources than an indexed text. You can just cast to indexed text when you need it, e.g.

let T be an indexed text; let T be the text in question...

That doesn’t help you with the relations problem, though, because you can’t repeat through texts any more than you can through indexed texts. For that reason, kinds of value might be a better option. KOVs can also have properties, which might come in handy.

–Erik