开发者

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

开发者 https://www.devze.com 2022-12-30 01:29 出处:网络
In Inform, I\'d like to be able to create a new action, and have it be able to work on aribitrary text.

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开发者_StackOverflow.

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


Again with the disclaimer that my experience of Inform 7 is limited to your previous question ;-)... I guess you'd need some [text] rather than an in-game [thing]?

Finding is an action applying to one topic.
Understand "Find [text]" as finding.
Carry out finding:
    say "You find [the topic understood]."
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号