Subcommands

A new extension is available at Github. This adds a “subcommand” property to objects, exposing the snippet which matched it. So if I >TAKE WAND, then the subcommand of the rusty iron rod is “wand”; if I >TAKE RUSTY IRON ROD, then it’s “rusty iron rod”.

This has been tested with 6L38, and should be portable to other ones by re-copy-pasting the I6 sections. The parts I modified are marked “===NEW===” to be easily moved around.

woot

Very cool.

Ooooh, this could be very useful!

The attached file seems to work fine on 6M62.
subcommands.i7x (15.7 KB)

I’ll just post a link here, in case anyone is subscribing to this topic.

Six years later, a new version is out! I realized it would be useful to have a snippet that referred to the verb itself, and then I realized it should go in this extension, and then I realized I should really incorporate vlaviano’s fixes, and…

Anyway! Here are new versions for 6L38, 6M62, and 10.1. Version 2 provides a new phrase (“the subcommand of the verb”) and also incorporates the bugfixes that add invalid snippets when disambiguating. The extensions also have different names so they can coexist in your Extensions directory.

Notably the last one crashes the IDE for me, which seems like a definite bug, but probably on my end; can anyone test out the 10.1 version? I’ll put them on Github once I know they work.

Subcommands 6L38.i7x (20.7 KB)
Subcommands 6M62.i7x (20.6 KB)
Subcommands 10-v2.i7x (20.5 KB)

3 Likes

wow. It has so vexed me that I couldn’t get the preposition used with a verb. This is going to be one of my obligatory extensions now. (The v10 version looks fine to me.)

2 Likes

That preposition is actually the one part that isn’t easily accessible within I6! The trick is to look at the parser’s results, then count how many tokens at the start are literals in the grammar line rather than tokens like [something], and return a snippet with that many words in it.

3 Likes