Repeating Text in Understand as a Mistake

Hello!

Is there a way to repeat text the player says in part of their command back to them? For example:

Understand "examine [text]" as a mistake ("You don't see a [text].").

Except in a way that it would understand the [text] to be referring to what the player typed. Thanks for any help!

When a [text] token is matched, the result is stored in “the topic understood”, which by the way is neither a text nor a topic. Yes, this is terrible naming.

Understand "examine [text]" as a mistake ("You don't see a [the topic understood].").

gives me:

*** Run-time problem P39: Attempt to say a snippet value which is currently invalid: words 0 to -1.

Am I using it right?

The reason I deleted my response is because [a] does not work as a snippet. You have to use something like [a object] or (identically) [an object] for the compiler to know what you’re talking about. So that’s where your error is coming from.

3 Likes

Oh, whoops. I actually edited my response without editing the code because I realized it seemed more adaptable – but the error is from without the [a].

The topic understood is not being set correctly in this case, but you can get the information another way:

To decide which snippet is consult text: (- (consult_from*100+consult_words) -).

Understand "examine [text]" as a mistake ("No [consult text] is visible.").
2 Likes

This bit is Inform 6, which is integrated into Inform 7 and can be used as part of Inform 7 code.

1 Like