Verbs And Prepositions.

Been reading How To Use Verbs in Quest documentation. As I understand, this construction should work. I'm putting it in the box underneath "Command Pattern" on the Verbs tab from tree.

hit #object#;swat #object#;swatat #object#;swat at #object#

The player swats at a yellow jacket. The first three in the above line work, but "swat at" (Broken into two words) doesn't. I get, "I can't see that. (at yellow jacket)"

Am I reading the documentation wrong?? What do I not understand??


The documentation section regarding verbs is very unclear. Or maybe I'm very dumb. What I want to do is fairly complex but it seems like I should have enough knowledge to do it. Maybe I need to understand "And" Can I put And in a script to check for two conditions??

Here's what I have in mind:

If player is in west bedroom AND
yellow jacket is in west bedroom AND
yellow jacket is still alive AND
player has weapon (Magazine) THEN
swat at yellow jacket

I've tried to accomplish that in the GUI, and it generated an enormous amount of code. No idea where all this code came from. I don't expect you guys to take time to read through, but if you could point me in the right direction as far as accomplishing my goal, I would appreciate it. I think maybe I could do it if I just know where to put the ANDs.

<object name="yellow jacket">
  <inherit name="editor_object" />
  <look><![CDATA[That's a mean looking yellow jacket. She's buzzing around your head. You might stand perfectly still and hope she ignores you. Yeah. You might as well hope you find a million dollars in your pocket. Or you could swat at her if you have some sort of weapon. 'Course that'll just make her mad if you miss. <br/><br/>What a dilemma!]]></look>
  <drop type="boolean">false</drop>
  <alt type="stringlist">
  <take type="boolean">false</take>
  <not_all />

hit #object#;swat #object#;swatat #object#;swat at #object#

Quest goes through the options in order. So the player types "swat at yellow jacket".

Quest compares that to the first option, hit #object#. It doesn't match.
Then it compares it to the second option, swat #object#. Does that match? Yes. So it stops pattern matching and movves on to the second step.

In that string, the #object has matched the text "at yellow jacket", so it tries to look up that object and can't find it.

This crops up occasionally. The simplest way to fix it would be changing the order. If you put swat at before swat, it will match correctly.

If player is in west bedroom AND
yellow jacket is in west bedroom AND
yellow jacket is still alive AND
player has weapon (Magazine) THEN
swat at yellow jacket

The simplest way to do something like this often works out to be checking the failure conditions first. So you end up with code like:

if (not game.pov.parent = west bedroom) {
  msg ("You can't swat it here.")
else if (GetBoolean (this, "dead")) {
  msg ("It's already dead.")
else if (not Got (magazine)) {
  msg ("You haven't got anything to swat it with.")
else {
  // none of the options above apply, so swat it.
  msg ("You flatten it with the magazine
  this.dead = true

(As this is a verb, you don't need to check that the player has selected the right object, or that the yellow jacket is in the same room as them, because Quest will do that for you before running the verb)

Hope that helps!

Thanks Mr. Angel. Yeah, it helps, but I'm frustrated I can't figure out how to write the code on my own. I have seen posters mention Quest 6. Not ready yet, apparently. Is there a pre-release version we can download??

You can learn about Quest 6 (aka QuestJS) here:

There is a tutorial that goes through downloading it. However, there is currently no editor, so you would be working in code.

Thanks Pixie. I looked at your practice game.

Now back to Quest 5, how do I use with?? I've read the material in the documentation and tried various places to put With, but all I get is an error message or "That doesn't work." I want the Player to have a choice of weapons.

"Swat bee with banana." No good
"Swat bee with magazine." Much better.


Log in to post a reply.