give man boots

I asked family members to beta-test a game, and they approached it with a whole different set of expectations. One was that they tried GIVE MAN BOOTS or just GIVE BOOTS, instead of the conventional GIVE BOOTS TO MAN.

Okay, so that is a challenge.

The problem is that the Quest way to handle commands is effectively to use the joining words - TO in this case - to delimit the words.

The first step then was to refactor the parser, giving commands the responsibility of scoring themselves, "matchItems" (so-called because we can also match items at the same time, and use the success of that as part of the scoring). This actually makes the parser pretty simple. It just goes through the list of commands, getting each one to rate itself, keeping the one with the highest score.

Then I could give my new GIVE command its own custom "matchItems" function. This in turn tries to match the string with items in scope, using the new array.fromTokens function, which in turn uses the old parser.findInList function the standard "matchItems" function uses. Then it checks it the first item is an NPC, and if not looks for an NPC in scope.

If it matches, you end up with the same set of parameters as you would have with GIVE BOOTS TO MAN, so when it comes to executing the command the same function can be used.

The end result is that now users can do GIVE MAN BOOTS, but at the same time the parser is now much more flexible for custom commands.


GIVE MAN BOOTS

I actually tried that, too.

That command structure works in the old parser games. Every time I try entering something like that in a Quest 6 game, I immediately think, 'oh yeah... Regular expression patterns don't work that way.'


I actually tried that, too.

You probably did not mean about it as much as they did.


Could this cause problems with games in other languages? And does it only affect the give command?


I modified the parser to allow commands to be customised to allow stuff like this, but the default is unchanged. There are then two Give commands, one with its custom bit.

So the default is the same, and therefore no negative impact on other languages. However, it gives extra flexibility, so potentially could make it possible to do stuff in other languages that was not possible before. I will not say easy, as the custom function is pretty complicated,


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums