Couple questions about Prepositions and Commands

QUEST 6/JS Questions
I was reading the "Creating Commands" doc for QJS, and I noticed a couple of things that I'm unclear about.

First, when you say "command" is that just the QJS term for verbs,
or is a command something special that's different from a verb?

Second, it says Quest has trouble parsing without an object separator, i.e. a preposition.
For some reason, I thought prepositions were usually a problem to be removed.
Like, we need a thing to tell the parser to remove and ignore prepositions,
because it doesn't want them there in the first place, but sometimes silly players try to use them.
Can I not just use the format of [Verb] [Noun] [Noun]?
E.g.: Fire Bow Rat, or Fill Bottle Water

I was typing up some instructions for the player, to clarify that my game always takes a tool before a target.
"Always type actions as [Action] [Tool] [Target], and never [Action] [Target] [Tool].
You Fire (the) Bow (at the) Rat, you don't Fire (at the) Rat (with the) Bow."
As I was doing that, I was also saying that they can skip articles and prepositions, as the game will ignore them,
which I assumed would be relatively easy or even standard code,
but it sounds like trying not to use prepositions may be more trouble than it's worth.

So... what's the deal with prepositions, now?

Sidenote: Am I being to picky by forcing that syntax? Will modern IF players be annoyed if they can't flip the nouns?


First, when you say "command" is that just the QJS term for verbs,

In Quest 5, a verb is a special type of command whose behaviour is different for every object it can be used on. I think this is similar the new one, but someone more experienced may be able to answer.

Second, it says Quest has trouble parsing without an object separator, i.e. a preposition

The problem with "[verb] [noun] [noun]" is working out which words belong to which noun if a noun has more than one word.

In Quest 5, the prepositions are used to determine where each noun begins and ends, and once that is done you can compare each noun to the list of available objects. Checking each possible grouping of words against each possible object rapidly becomes a large, slow problem.

I don't know how they're doing it in the new engine… I did post an algorithm a while back which I thought would provide a decent compromise; but it's still slow as hell if you have many objects with words in common. At some point maybe I'll go back and polish it further…


Hello.

I'm pretty sure commands and verbs are one in the same.

Also, the commands use Regular Expressions as patterns for the parser to match.

Also also, this is all being designed so that games will run in any browser, so basic Regular Expressions must be used (no group capture mode (see this thread)).

So, most patterns in Quest 6 are like:

/^(?:fire) (.+) (?:at) (.+)$/

... or ...

/^(?:fill) (.+) (?:with) (.+)$/

If you wanted to leave out the prepositions, you'd have something like /^(?:fill) (.+) (.+)$/, and that would confuse the parser -- because the captured text would just be everything after "give". If you didn't allow object aliases with spaces, you could pull this off.


BUT, you can edit all the patterns and use capture groups in your RegEx. Just know that it won't work unless the player has an up-to-date version of Firefox, Chromium, or one of the recent, popular browsers. So, this is not recommended, although I believe using capture groups would pretty much solve your issue. Alternatively . . .

You could also make multiple commands to handle the same action.

You could have a command called "shootBowAt" with the pattern /^(?:shoot) (.+) (?:at) (.+)$/, and another command called "shootWithBow" with the pattern /^(?:shoot) (.+) (?:with) (.+)$/. Have each command's script figure out who is shooting and who is being shot, then pass those parameters to a function called "shootBow" to have it finish the job.


PS

We are unofficially using the QuestKit forum when posting about Quest 6 stuff. (That forum's name will soon be changed to "Quest 6", as QuestKit was abandoned long ago.)

I was posting Quest 6 stuff in the Quest forum at first, and, come to find out, I was confusing the people who are trying to learn to use Quest 5. (Whoops!)

So, this post will probably end up being moved to the QuestKit forum, just to warn you in advance. :)


Ha! mrangel beat me to it!

a verb is a special type of command whose behaviour is different for every object it can be used on


Hmmm... reading over all this, I feel like I'm just thinking too old school, or too rigid ... or is it lazy? I don't really want to make separate verbs for "fire [] at []" and "shoot [] with []," but ... I guess I coooould, just to be nice!
It was indeed my intention to limit all objects to single word names, so I see how the separators are helpful with freeing up your naming options, as well.

It also occurs to me that, while forcing a single format might reduce guesswork, it also hampers my options for making puzzles. For instance, if I wanted the player to use their sword like a lever to tip something over,
what would I have them say? "Lever Sword Statuette" ? That just doesn't look right at all.
"Lift/Tip Statuette with Sword" makes much more sense. So, I guess I better get used to it, ha!

We are unofficially using the QuestKit forum when posting about Quest 6 stuff.

D'oh! Duelly noted.


Most players accustomed to Quest games would try USE SWORD ON STATUETTE

Most everyone else would try to "guess the verb", so to speak. (Hehehe.) I would assume I had to either STAB STATUETTE WITH SWORD or PUT SWORD UNDER STATUETTE, then LIFT SWORD, or something like that. I would probably try LIFT STATUETTE WITH SWORD, too. (Even if I were playing a Quest game, I wouldn't try USE until all else failed. (I rather enjoy guessing the proper terminology, I reckon.))


There is an update on GitHub (as opposed to a new release; you will need to get _parse.js) that will let you reverse the order of nouns.

See what to do here:
https://github.com/ThePix/QuestJS/wiki/More-on-commands

Part of the motivation is that I suspect work order will be reversed in some languages.


See what to do here:
https://github.com/ThePix/QuestJS/wiki/More-on-commands

I wonder if you'll get any old-time 'nix nerds telling you that the plural of regex is regexen ☺ I think both forms are in use now, but there used to be some people who got quite intense about it.


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

Support

Forums