I’m contemplating incorporating it into an existing game. Is there an extension or has anyone else done it? I haven’t looked yet, but I imagine that the Lite handling isn’t going to be portable because of the parser differences.
You mean presenting disambiguation options as a numbered list, and then accepting a number as a response?
I don’t think there’s anything builtin that behaves that way, although most of the logic is already there in the way it handles plural disambiguation (defaulting to “Which [whatever] do you mean, the first [thing], the second [thing]…”), so I think you could implement something like this by “just” re-writing askDisambig()
…but I haven’t actually tried implementing it and so I don’t know what inevitable gotcha(s) would make this more complicated that it seems.
Yes, that’s what I mean, and I didn’t even so much as glance to see what kind of retrofitting would be required, I just started out by asking if anyone knew of an extension or had made a module-ish of their own…
Wow, that turned out much easier than I expected! There is some existing stuff to piggyback off of.
All I had to do was insert a single line in a modification of MessageHelper.askDisambigList()
and copy out 20 iterations of defOrdinal
.
Here’s how it went if any adv3-ers are interested:
modify MessageHelper
askDisambigList(matchList, fullMatchList, showIndefCounts, dist)
{
// copy-paste the original method.
// insert this line in what would have been
// the blank line 3197 of en_us.t, just before
// `if (equivCnt > 1) {`
"<b>(<<toString(i)>>)</b> ";
}
;
#undef defOrdinal
#define defOrdinal(val) object ordinalWord= #@val numval=val
defOrdinal(1);
// etc. etc. ....
defOrdinal(20);
Note that because the ordinals are employed by DisambigOrdProd
, the parser will choose a true vocabulary match for one of these single-digit answers before assuming that the single digit is a disambig list item. This is done not by badness
but by a command ranking criterion.
So, although I haven’t created this test case yet, the lib documentation states that in this peculiar situation it should behave thus:
You see button 2, a big button and a "help" button.
>push button
Do you mean (1) button 2, (2) the big button, or (3) the "help" button?
>1
You push button 2.
>push button
Do you mean (1) button 2, (2) the big button, or (3) the "help" button?
>2
You push button 2.
That seems a bit convoluted, but true vocabulary takes precedence.
[Verified that the above behavior takes place, so defining these new single-digit ordinals will not interfere with/overshadow existing vocabulary.]