The main motivation wasn’t providing shortcuts so much as wanting the narrative/gameplay effect. When the player gets conked on the head and wakes up in a strange location so they don’t know which way is north, that kind of thing. It also helps with things like hallways and outdoor locations where trying to align everything at four or eight compass points can either feel artificial or be awkward (if you’re mostly using the canonical four directions and occasionally using a diagonal, those diagonals can turn into accidental puzzles just because the player isn’t used to having to use them).
That aside, it looks like dictionaries don’t get me what I want either. There seems to be very little documentation on them: the page from the System Manual seems to be all there is. It mentions the idea of using multiple dictionaries “to create different parsing modes, each having their own separate vocabulary words”, but the documentation provides no examples and there don’t appear to be any in the library source.
But what it looks like is that dictionary
instances only hold noun phrase stuff, not action/verb phrases, and there doesn’t appear to be any way to enable/disable productions in the middle of command processing. Most of this stuff isn’t T3 code (that is, the stuff that gets fed into t3make
) but are compiled-in behaviors of the interpreter.
The point of contact (between implementor-supplied T3 code and interpreter-supplied compiled C stuff) is in e.g commandPhrase.parseTokens()
, which takes the list of tokens (from the player input) and a dictionary instance as its arguments. It returns a list of matching actions which is then further processed in ways that don’t matter here.
The problem is that commandPhrase.parseTokens()
prunes the action list. So in the example I used earlier, tokenizing >LIGHT
and giving it to parseTokens()
returns a list containing only one possible action: predicate(LIGHT)
. Because it’s evaluated the badness
of all of the productions and it’s discarded all of the noun-as-verb productions.
This means I can’t just get the results from parseTokens()
and sort through them with my own code. If the badness
on the noun-as-verb productions is lowered, they’ll “win” and parseTokens()
will return them instead (in this case there will be multiple candidates, and one will be selected in executeCommand()
after noun resolution), and predicate(Light)
won’t be on the resulting list.
And I don’t think there’s any way to dynamically modify the badness
of a grammatical rule, which I think would solve the problem (by returning a different badness
for noun-as-verb rules based on whether or not processing is happening in disambiguation).
So…back to the drawing board.