ThePix / QuestJS

A major re-write of Quest that is written in JavaScript and will run in the browser.
MIT License
66 stars 12 forks source link

What if player ignores disambiguation menu? #68

Closed ThePix closed 2 years ago

ThePix commented 2 years ago

Scenario: There is a chocolate cake hat and a lemon hat. The user types GET CAKE, and Quest asks which. The user changes her mind and types L. How should Quest react?

Ideally the parser would realise this is a command on its own, LOOK, but the user might type L to indicate lemon cake.

This does depend on the type of menu Quest uses.

bpetersonisme commented 2 years ago

I think that, in such an ambiguous case, the menu should almost certainly interpret the "L" as "lemon cake" instead of "look." This runs closer to scoping rules in regular programming languages. In Javascript, for example, a local variable will take precedence over a global variable of the same name.

In the case of a disambiguation menu, the logic would be most consistent if it checked for a match from the menu before checking the global command list.

ThePix commented 2 years ago

Thank, it was partly rhetorical; me flagging an issue.

In the case of disambiguation, Quest will list the items in question. It will try to match input text against them, and will go for the first it find. If it does not match any, it will treat it as a new command.