Printed form of verbs

Suppose I have an intransitive action allowing the player to cast the important THWOMP spell, which can be triggered by CAST THWOMP or THWOMP or simply T. The problem is that in the latter two cases, the parser will respond to commands like THWOMP ME or T ME as “I only understood you as far as wanting to thowmp” or “I only understood you as far as wanting to t”; I want it to respond with the full, “I only understood you as far as wanting to cast thwomp.” I’ve got standard I6 code to do so if I can hack in an I6 code block, but this sort of thing should still be easy in I7 itself. The I7 documentation is garbage, though, and searching the forum for this problem points me toward an I7 bugtracking site that’s been defunct for a while.

You can use the ‘mistake’ mechanism to round up all the variations, and any text that gets typed after, and send them to one place. Here’s an example:

The Arena of Frequent And Bloody Conflict is a room.

Thwomping is an action applying to nothing.
Understand "t", "thwomp", "cast thwomp" as thwomping.

Report thwomping:
	say "THWOMP. You cast thwomp.";

Understand "t [text]", "thwomp [text]", "cast thwomp [text]" as a mistake ("I only understood you as far as wanting to cast thwomp.").

Test me with "t/thwomp/cast thwomp/t me/thwomp tree/cast thwomp on mother".

People have got their complaints about it, but garbage isn’t a reasonable description.

Whereas it’s possible the forum’s search mechanism IS garbage! You can usually get a better result by doing a site search for the same thing direct from your browser address bar: “site:https://intfiction.org (search terms here)”.

-Wade

2 Likes

Great, thanks! That should fix the problem. (And no, I still maintain that the documentation is garbage. It’s basically a series of worked examples, which is great if you’re trying to do something that matches one of them and terrible if you’re trying to understand how exactly the language works. It’s a shame, because there are some great ideas in the design of I7; the documentation just won’t tell me how to get at them.)

See §17.21 (Understanding mistakes) of Writing with Inform.

1 Like

Thanks, though there are some scoping issues and other complications with the particular situation I’m dealing with (in general, not just the bit above) that go beyond what’s covered there. The way to resolve it is probably to license an “Understand [stuff] as mistake…” rule under some involved scenario, but I’ll have to play around with it to figure out exactly what syntax the compiler wants.

The documentation can sometimes make it hard to find stuff.

In this case, searching the docs for “understood you as far as” or “as far as wanting” yields nothing.
But searching for “only understood” or “as far as” will result in references to 18.35. Printing a parser error, where it says that the error is called the “only understood as far as error”, and to the Recipe Book at 6.17. Clarification and Correction, where the example 424 (“Cave-troll”) contains:

Rule for printing a parser error when the latest parser error is the only understood as far as error and the player's command matches the text "with": [...]

Adapting that, we can write:

Rule for printing a parser error when the latest parser error is the only understood as far as error and the player's command matches the regular expression "t|thwomp *":
	say "I only understood you as far as wanting to cast thwomp.";

(I’m not saying that this would be better than Wade’s version; it’s just how I approached the problem.)

2 Likes

That approach works, but note that it doesn’t give you the desired response to, for example, CAST THWOMP ME or CAST THWOMP AT MYSELF. Those commands throw a different parser error (the didn’t understand error), so you’d need to write a rule to catch that one too.

(If “cast” on its own is a command verb you’d get different behaviour again. Wade’s solution avoids the bother.)

1 Like

I don’t think there’s a standard way to do this within I7 itself. I’ve just dropped down to I6 whenever I needed to change this behavior.

2 Likes