How can I handle arbitrary text as "nouns" in Inform 7?

Posted by Beska on Stack Overflow See other posts from Stack Overflow or by Beska
Published on 2010-05-07T15:17:28Z Indexed on 2010/05/07 15:48 UTC
Read the original article Hit count: 183

Filed under:

In Inform, I'd like to be able to create a new action, and have it be able to work on aribitrary text.

I can easily create a new action that will work on existing things.

Finding is an action with past participle found, applying to one thing.
Understand "Find [something]" as finding.
Carry out finding:
say "You find [the noun]."

But this only works on items that exist within the game world. If I try to "find fdsljk", for instance, it will fail because I haven't created a "fdsljk".

I'd like to be able to "find fdsljk" and then be able to grab that extra text and respond with it...something like "You find the fdsljk."

I was thinking that something like

A foo is a kind of value.
Finding is an action with past participle found, applying to one foo.
Understand "Find [something]" as finding.
Carry out finding:
    say "You find [the foo]."

might be close...but it doesn't work. I get an error that reads:

You wrote 'say "You find [the foo]."' , and in particular 'the foo': but this asked to say something of a kind which can't be said, or rather, printed. Although this problem can arise when you use complicated text substitutions which come in variant forms depending on the kinds of value used, far more often what this means is just that you tried to use a substituted value (e.g., in 'say "The dial reads [V]."') of a kind which could not be printed out. For instance, if V is a number or a piece of text, there is no problem: but if V is a parsing topic, say an entry in a 'topic' column of a table, then this problem will arise.

The italics are mine, and highlight the key...I think this should be doable, but I'm taking the wrong path. Clues?

© Stack Overflow or respective owner

Related posts about inform7