Finding "Verbs" in the Quest Help screen

I'd like to know more on the use of Verbs (located under game in the tree on the left of the screen)
I can't seem to find any help on Verbs in the Quest help screen.
If it's there then could someone tell me what heading its under so I can find it please.


is this what you wanted? https://docs.textadventures.co.uk/quest/elements/verb.html

(note that all of the Attributes: 'name' / 'pattern' / 'property' / 'unresolved' / template' / response', within the Verb are optional)

<verb name="NAME_OF_VERB" pattern="INPUT_PATTERN" unresolved="TEXT_DISPLAYED_WHEN_UNRESOLVED" property="NAME_OF_ACTUAL_VERBS_ATTRIBUTE_BEING_USED_WHICH_IS_EITHER_A_SCRIPT_ATTRIBUTE_OR_A_STRING_ATTRIBUTE_WITHIN_THE_OBJECT_BEING_USED_ELSE_IF_NO_ATTRIBUTE_THAN_IT_DOES_THE_DEFAULT_RESPONSE_ELSE_IF_A_INVALID_ATTRIBUTE_TYPE_IS_USED_THEN_GET_AN_ERROR_MESSAGE" response="TEXT_FOR_DISPLAYING_DEFAULT_RESPONSE" template="TEMPLATE_NAME">
  // scripting
</verb>

or

<verb>

  <name>NAME_OF_VERB</name>

  <pattern>INPUT_PATTERN</pattern>

  <unresolved>TEXT_DISPLAYED_WHEN_UNRESOLVED</unresolved>
  <property>NAME_OF_ACTUAL_VERBS_ATTRIBUTE_BEING_USED_WHICH_IS_EITHER_A_SCRIPT_ATTRIBUTE_OR_A_STRING_ATTRIBUTE_WITHIN_THE_OBJECT_BEING_USED_ELSE_IF_NO_ATTRIBUTE_THAN_IT_DOES_THE_DEFAULT_RESPONSE_ELSE_IF_AN_INVALID_ATTRIBUTE_TYPE_IS_USED_THEN_GET_AN_ERROR_MESSAGE</property>

  <response>TEXT_FOR_DISPLAYING_DEFAULT_RESPONSE</response>

  <template>TEMPLATE_NAME</template>

</verb>

if not, let me know


Hi hegemonkhan.

It was information I was seeking about fulling in the blank fields after you have created a new verb for the Game Verbs.
Looking at the user interface you can select a 'command pattern' or a 'regular expression' (not certain which is means by regular expression.
Does 'command pattern' mean I can enter more than one word as the verb?
Then there is 'attribute' What would be entered into this blank field?
Another field is 'scope' (I'm not certain how you would use this or what to type in. Maybe scope is the object that you use the verb on.

You also have a drop down menu that lists Text, Template, Expression.
I understand the use of text and I think you use expression to display things such as player.alias. I'm not certain how you use Template.


Most of those are the same as for commands.

Looking at the user interface you can select a 'command pattern' or a 'regular expression' (not certain which is means by regular expression.
Does 'command pattern' mean I can enter more than one word as the verb?

A "regular expression" is a complex language which is often used in programming for search-and-replace functionality. Regular expressions are incredibly powerful, but may be hard to work with; I believe I posted a summary of some of the simpler features in response to a recent question here. A regular expression looks like ^paint (?<object>.+)$.

Command patterns are a simpler way of setting a pattern; Quest converts them into regular expressions when the game starts. A command pattern might look like paint #object#, or say #text#, or kick #object#;hit #object#;smash #object#. You can list alternatives by putting a semicolon between them.

Then there is 'attribute' What would be entered into this blank field?

A verb is a special type of command, which has a predefined script.
The script checks if the object it is being used on has a specific script attribute.

So, for example, if "attribute" is set to "break" then using this verb on an object will check to see if that object has a script attribute named "break", and run it. If the attribute doesn't exist, the default message will be printed. The attribute is normally the same as the name of the verb, and is set automatically by giving an object this verb.

Another field is 'scope' (I'm not certain how you would use this or what to type in. Maybe scope is the object that you use the verb on.

Scope will usually be something like visible, room, or inventory - but there are an awful lot of options like container as well, which help Quest to guess which object the player meant.


Oh… templates are a weird thing you probably don't need. They're used to separate text from code, which is really useful if you're developing the same game in multiple languages, or if you're writing a library.

Basically, if you have a line in a library somewhere:

<dynamictemplate name="CantSmoke">"You can't smoke the "+object.alias+"."</dynamictemplate>

then for your "smoke" verb you could choose "Template" type default message, and put CantSmoke in the box.

Some of the built-in verbs use this feature, so that the <dynamictemplate line is placed in the language file, meaning that the message is right for whichever language the game creator has chosen.


Thanks mrangel.

That makes things clearer for me.
I might experiment on some of the things you've told me about to get some experience in using them.


Hi mrangle

You wrote
Scope will usually be something like visible, room, or inventory

I'm thinking this means that if I typed inventory into the Scope field then the verb would only work if the object was in the players inventory. I tried this but it does not seem to be working so maybe having inventory in the scope field does something else.


It's based on how Quest looks up object names.

For example, if there is a red flower on the ground, and a blue flower in the inventory. The player types "drop flower", and the drop command has scope inventory, so it knows that the player means the blue flower.

When checking the object name a player has typed, Quest will look at:

  1. Objects in scope whose alias exactly matches what the player typed
  2. Objects in scope whose alias includes all the words the player typed
  3. Other visible objects whose alias exactly matches what the player typed
  4. Other visible objects whose alias includes all the words the player typed

At each of those 4 stages, if it finds exactly one matching object, Quest will run the command script using that object. If it finds more than one, it will display a menu asking the player which they meant. And if it finds none, it will look at the next group of object.

If you want to make a command (or verb) only work when the object is held, you'll need to check it in your own script. However, it does work the other way - if the scope variable is the name of a room or container (or the name of an objectlist attribute of the player), then the player will be able to use the verb on objects in that room even if they can't see them.

Now that I think about it, this seems a little counterintuitive for verbs. I think there should be a checkbox in the editor, to restrict the verb to objects that are in scope. It would basically involve changing the defaultverb type:

<type name="defaultverb">
  <separator>[VerbObjectSeparator]</separator>
  <multiobjectmenu>[MultiObjectVerbMenu]</multiobjectmenu>
  <multiobjectdefault>[DefaultMultiObjectVerb]</multiobjectdefault>
  <multiobjectmenuempty>[NoObjectsAvailable]</multiobjectmenuempty>
  <script type="script">
    <![CDATA[
    if (not IsDefined("object2")) {
      object2 = null
    }
    if (GetBoolean (object, "enforcescope") and not ListContains (GetScope ("object", "object", "object"), object)) {
      if (HasString (this, "scopemessage")) {
        msg (this.scopemessage)
      }
      else {
        msg ("You can't do that.")
      }
    }
    else {      switch (TypeOf(object, this.property)) {
        case ("script") {
          if (object2 = null) {
            do (object, this.property)
          }
          else {
            msg (this.multiobjectdefault)
          }
        }
        case ("string") {
          if (object2 = null) {
            msg (GetString(object, this.property))
          }
          else {
            msg (this.multiobjectdefault)
          }
        }
        case ("scriptdictionary") {
          if (not object2 = null) {
            HandleMultiVerb (object, this.property, object2, this.multiobjectdefault)
          }
          else {
            objectlist = ListCombine (ScopeReachableInventory(), ScopeReachableNotHeld())
            excludelist = NewObjectList()
            list add (excludelist, game.pov)
            list add (excludelist, object)
            candidates = ListExclude(RemoveSceneryObjects(objectlist), excludelist)
            if (ListCount(candidates) = 0) {
              msg (this.multiobjectmenuempty)
            }
            else {
              game.pov.multiverb = this.property
              game.pov.multiverbobject = object
              game.pov.multiverbobjectdefault = this.multiobjectdefault
              ShowMenu (this.multiobjectmenu, candidates, true) {
                if (not result = null) {
                  HandleMultiVerb (game.pov.multiverbobject, game.pov.multiverb, GetObject(result), game.pov.multiverbobjectdefault)
                  game.pov.multiverb = null
                  game.pov.multiverbobject = null
                  game.pov.multiverbobjectdefault = null
                }
              }
            }
          }
        }
        case ("null") {
          if (HasString (this, "defaulttext")) {
            msg (this.defaulttext)
          }
          else if (not this.defaulttemplate = null) {
            msg (DynamicTemplate(this.defaulttemplate, object))
          }
          else if (not this.defaultexpression = null) {
            params = NewDictionary()
            dictionary add (params, "object", object)
            msg (Eval(this.defaultexpression, params))
          }
          else {
            error ("No verb response defined")
          }
        }
        default {
          error ("No verb response defined")
        }
      }
    }
    ]]>
  </script>
</type>

Then you could make a verb like:

<verb name="read">
  <property>read</property>
  <scope type="string">inventory</scope>
  <enforcescope />
  <scopemessage type="string">You can only read things you are holding.</scope>
</verb>

Thanks mrangel for the code.
I might consider adding the extra code later.


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

Support

Forums