Pre-release
AdventureJS Docs Downloads
Score: 0 Moves: 0

Instance of: adventurejs.Verb

Defined in: adventure/dictionary/verbs/jump.js, line 6

Tutorials: Subscriptions VerbAnatomy VerbProcess ModifyVerbs ModifyVerbs

Todos: if nested on thing like vine, let go/fall

Runtime node: game.dictionary.verbs.jump

Extends: go

Synonyms: jump, hop

Description

> jump
You take a small jump!

Jump behaves differently depending on player's context, whether they're nested in another object. Authors wanting to make use of it may want to modify the verb to offer different results. See Modify Verbs to learn more.

jump verb logic

Verb logic falls into a few recognizable patterns. Direction verbs tend to be simple and redirect to tryTravel(). Manipulation verbs test whether one asset is allowed to interact with another asset. Locomotion verbs test the player's current ability to move in a specified way. Many verbs are similar, but no two verbs are identical. Each verb has its quirks. If you would like to learn more about general verb logic, we recommend you see the Verb Anatomy and Verb Process pages. Verb phases and verb actions / reactions offer various hooks to customize verb behavior. If you find that you want still more flexibility, you may want to investigate the patchVerb method, which lets you replace entire blocks of verb code. You can also write verbs from scratch if you're so inclined. See Modify Verbs for a complete list of verb modification methods.

The following sections provide information that is specific to the verb jump, though they include many features which are common to most verbs.

  • Sentence Structures help filter player input by defining what sentence structures jump can handle.
  • Verb Phrases describe the direct and indirect objects that jump can handle.
  • Verb Subscriptions enable jump to act on specific assets, and provide a collection of properties for customizing those interactions.
  • Verb Phases offer a broad method for authors to hook into default logic and override it with custom code.
  • Verb Actions offer a surgical method for authors to hook into jump's default logic and inject custom code.
  • Verb Reactions are Verb Actions that occur as secondary effects of successfully applying jump.
  • Verb Params contain properties that are distinct to jump. Not all verbs have params.
  • Verb Methods lists the methods that jump inherits from the Verb class.
  • Verb Properties lists the properties that jump inherits from the Verb class.

jump sequencing

jump subscriptions

An asset must be subscribed to a verb for that verb to act upon that asset (with some exceptions). Though verbs are universal, each asset's verb subscriptions are distinct objects that can be used to customize how a given verb interacts with a given asset. To say it another way, a verb subscription is a collection of properties that defines how a verb should be applied to an asset; which allow authors to override a verb's default behaviors on a per-asset basis.

It's important to note that verb subscriptions need to be declared as direct or indirect, depending on whether the asset will be used as a direct object or indirect object. In the case of "unlock lock with key", the lock is the direct object and the key is the indirect object, and each asset needs to be subscribed to unlock in the appropriate way. (It's allowed, and a common pattern, to subscribe assets directly and indirectly to the same verb.)

Expand for example
MyGame.createAsset({
  class: "Lock",
  name: "lock",
  dov: { unlock: true },
});
MyGame.createAsset({
  class: "Key",
  name: "key",
  iov: { unlock: true },
});

As shown in the above example, dov: { unlock: true } is the minimum that is required to subscribe an asset to a verb. However, verb subscriptions have many properties that can be used to customize how this verb is applied to this asset. (Setting any property eliminates the need to set verb: true. ) Below is a list of verb subscription properties that authors may find useful.

  • automatically allows for some verbs to be performed automatically if context calls for it; for example, when unlocking a door in order to pass through it. This takes precedence over global settings.
    Expand for example
    MyGame.createAsset({
      class: "Thing",
      name: "universal widget",
      dov: { jump: { automatically: true } },
    });
    
  • automatically_after_use if automatically is set true, this sets it so that a verb can only be applied automatically after a player has already used it manually. This is to prevent automatic use of tools from breaking puzzles. For example, imagine one door with many keys but only one that works; if choosing the right key is part of the puzzle, this option prevents players from simply saying "unlock door" and having the right key automatically selected for them.
    Expand for example
    MyGame.createAsset({
      class: "Thing",
      name: "universal widget",
      dov: { jump: { automatically_after_use: true } },
    });
    
  • doBeforeTry Verb phases provide methods to override default verb behaviors. See the verb phases section on this page to learn more about jump's verb phases.
    Expand for example
    MyGame.createAsset({
      class: "Thing",
      name: "universal widget",
      dov: { 
        jump: { 
          doBeforeTry: function (e) {
            console.log("jump.doBeforeTry");
          },
        } 
      },
    });
    
  • doAfterTry Verb phases provide methods to override default verb behaviors. See the verb phases section on this page to learn more about jump's verb phases.
    Expand for example
    MyGame.createAsset({
      class: "Thing",
      name: "universal widget",
      dov: { 
        jump: { 
          doAfterTry: function (e) {
            console.log("jump.doAfterTry");
          },
        } 
      },
    });
    
  • doBeforeSuccess Verb phases provide methods to override default verb behaviors. See the verb phases section on this page to learn more about jump's verb phases.
    Expand for example
    MyGame.createAsset({
      class: "Thing",
      name: "universal widget",
      dov: { 
        jump: { 
          doBeforeSuccess: function (e) {
            console.log("jump.doBeforeSuccess");
          },
        } 
      },
    });
    
  • doAfterSuccess Verb phases provide methods to override default verb behaviors. See the verb phases section on this page to learn more about jump's verb phases.
    Expand for example
    MyGame.createAsset({
      class: "Thing",
      name: "universal widget",
      dov: { 
        jump: { 
          doAfterSuccess: function (e) {
            console.log("jump.doAfterSuccess");
          },
        } 
      },
    });
    
  • enabled allows changing the state of an asset's responsiveness to a given verb. If set false, a subscribed asset will not respond to the verb. This is useful for temporarily disabling verbs for specific assets; for example, if you had a door that could not be unlocked until another action was completed. Authors can enable or disable an individual verb subscription via asset.setDOV(verbname) and asset.unsetDOV(verbname)
    Expand for example
    MyGame.createAsset({
      class: "Thing",
      name: "universal widget",
      dov: { jump: { enabled: true } },
    });
    
  • on_success is an optional parameter. It is set as a string by default, but authors may provide a string or array or function to be served by getStringOrArrayOrFunction(). The resulting string will be appended to the verb's default success message.
    Expand for example
    MyGame.createAsset({
      class: "Thing",
      name: "universal widget",
      dov: { jump: { on_success: "You jump the thing. " } },
    });
    
  • on_first_success is an optional parameter. It is set as a string by default, but may provide a string or array or function to be served by getStringOrArrayOrFunction(). The resulting string will be appended to the verb's default success message the first time it is applied to this asset.
    Expand for example
    MyGame.createAsset({
      class: "Thing",
      name: "universal widget",
      dov: { jump: { on_first_success: "You jump the thing the first time. " } },
    });
    
  • on_failure is an optional parameter. It is set as a string by default, but may provide a string or array or function to be served by getStringOrArrayOrFunction(). The resulting string will be appended to the verb's default failure message.
    Expand for example
    MyGame.createAsset({
      class: "Thing",
      name: "universal widget",
      dov: { jump: { on_failure: "You failed to jump the thing. " } },
    });
    
  • on_first_failure is an optional parameter. It is set as a string by default, but may provide a string or array or function to be served by getStringOrArrayOrFunction(). The resulting string will be appended to the verb's default failure message the first time it is applied to this asset.
    Expand for example
    MyGame.createAsset({
      class: "Thing",
      name: "universal widget",
      dov: { jump: { on_first_failure: "You failed to jump the thing the first time. " } },
    });
    
  • once if true, the verb can only be applied once to the asset. The verb subscription will be disabled after use.
    Expand for example
    MyGame.createAsset({
      class: "Thing",
      name: "universal widget",
      dov: { jump: { once: true } },
    });
    
  • then_destroy allows author to specify that this asset should be destroyed after using. If then_destroy is set, the asset will be destroyed after a single use regardless of how once is set. By default, then_destroy is set to a boolean. It may optionally be set to string or array or function subject to getStringOrArrayOrFunction(). If any of those types are found, they will be called and returned as results.
    Expand for example
    MyGame.createAsset({
      class: "Thing",
      name: "universal widget",
      dov: { jump: { then_destroy: true } },
    });
    
  • with_anything pertains only to indirect objects. If true, this asset can be used as an indirect object of this verb with any direct object.
    Expand for example
    MyGame.createAsset({
      class: "Thing",
      name: "universal widget",
      iov: { jump: { with_anything: true } },
    });
    
  • with_assets allows author to specify particular assets that can interact with this one using the given verb. For example "unlock door with key" where the specified key is the only asset that can unlock door. This works distinctly for direct and indirect verb subscriptions. So, for instance, in "unlock door with key", the door might have a direct object subscription, while the key has an indirect object description.
    Expand for example
    MyGame.createAsset({
      class: "Door",
      name: "gold door",
      dov: { unlock: { with_assets: [ "gold key" ] } },
    });
    MyGame.createAsset({
      class: "Key",
      name: "gold key",
      iov: { unlock: { with_assets: [ "gold door" ] } },
    });
    
  • with_classes allows author to specify particular classes that can interact with this asset using the given verb. For example "unlock door with skeleton key" where any instance of the class SkeletonKey can unlock door. This works distinctly for direct and indirect verb subscriptions. So, for instance, in "unlock door with skeleton key", the door might have a direct object subscription, while the key has an indirect object description.
    Expand for example
    MyGame.createAsset({
      class: "Door",
      name: "red door",
      dov: { unlock: { with_classes: [ "SkeletonKey" ] } },
    });
    MyGame.createAsset({
      class: "SkeletonKey",
      name: "skeleton key",
      iov: { unlock: { with_classes: [ "Door", "Chest" ] } },
    });
    
  • with_nothing pertains only to direct objects. If true, the specified verb can be applied to the direct object without the use of any indirect object.
    Expand for example
    MyGame.createAsset({
      class: "Thing",
      name: "universal widget",
      dov: { jump: { with_nothing: true } },
    });
    
  • with_params is used to contain a set of parameters that are specific to this particular verb. For example, plugIn includes with_params.max_connections for setting limits on how many other assets this asset can be plugged in to. See the with_params section on this page to learn more about jump's parameters.
    Expand for example
    MyGame.createAsset({
      class: "Thing",
      name: "universal widget",
      dov: { jump: { with_params: { jump_property: value } } },
    });
    
  • with_prepositions allows author to explicitly permit certain prepositions to be used with a verb on this object. For instance: "knock over umbrella stand" might fail with a message of "you can't knock over the umbrella stand"; setting umbrella_stand.dov.knock.with_prepositions = ["over"] will allow the action to succeed.
    Expand for example
    MyGame.createAsset({
      class: "Thing",
      name: "universal widget",
      dov: { jump: { with_prepositions: [ "through", "over" ] } },
    });
    

Notes

  • To learn more about working with verb subscriptions, see Verb Subscriptions.
  • These are most, but not all, of the properties of a verb subscription. For full reference, see the VerbSubscription class.

jump sentence structures

accepts_structures: [
  "verb",
  "verb noun",
  "verb preposition noun",
  "verb noun noun",
  "verb preposition noun preposition noun"
]

The parser uses multiple filtering methods to try to channel player input into useable tokens. Sentence structures are defined for each verb in order to narrow down the input that the verb can handle. For example, the verb "hit" might accept "verb noun" as in "hit troll", or "verb noun preposition noun" as in "hit troll with sword", whereas an intransitive verb like "jump" might accept "verb" as a complete sentence. Input that isn't accepted will return a warning to the player.

A note about adverbs: though the parser does handle some adverbs, such as "carefully examine tiara" and "turn left", it excludes them from consideration in sentence structures. Due to the slipperyness of the English language, an adverb can appear in multiple positions in a sentence while still describing the same verb, which presents enough possible word combinations to make sentence structures less useful as a filtering tool. Instead, the parser puts adverbs aside and handles them separately.

Notes

  • It is possible for authors to modify a verb's structures through the use of patchVerb.
  • To learn more about modifying verbs, see Modify Verbs.

jump phrases

phrase1:
{
  accepts_noun:true,
  noun_must_be:
  {
    known: true,
    tangible: true,
    present: true,
    visible: true,
    reachable: true,
  },
  accepts_preposition: true,
},
phrase2:
{
  accepts_noun:true,
  noun_must_be:
  {
    known: true,
    tangible: true,
    present: true,
    visible: true,
    reachable: true,
  },
  accepts_preposition: true,
},

The AdventureJS parser uses multiple filtering methods to try to interpret player input. A verb's phrases may consist of a noun and/or a preposition. Whether any noun is defined as a direct or indirect object is up to that verb's unique logic. Each verb defines a unique set of phrases depending on what its logic can handle. Verbs may handle zero, one, two, or three nouns. The nested noun_must_be object sets conditional qualifiers to help narrow down assets that the verb might act upon. Input that isn't accepted will return a warning to the player.

Notes

  • It is possible for authors to modify a verb's phrases through the use of patchVerb.
  • To see a list of properties that can be set for phrases, see the Phrase class.
  • To see a list of properties that can be set for phrase.noun_must_be, see the NounMustBe class.
  • To learn more about modifying verbs, see Modify Verbs.

jump phase hooks

Verb phase hooks let authors override verb subscriptions for specific assets when jump is applied to them. This is a broad method for customizing verb/noun interactions on a per-asset basis. For example, an author might supply completely different logic for "throw feather" vs "throw baseball" vs "throw anvil".

When jump.do() is called, it attempts to run a sequence of methods, or phases, as listed below. The four hooks have no default logic of their own but provide methods to inject custom code at any point in the life cycle of the verb action. See below for examples of how to use verb phases for jump.

do

    doBeforeTry hook

    MyGame.createAsset({
      class: "Thing",
      name: "This Asset",
      dov: {
        jump: {
          doBeforeTry: function( params )
          {
            let msg = `You're about to try to jump ${this.articlename}. `;
            this.game.print(msg);
            return;
          },
        },
      },
    });

    doTry handles logic to determine if jump can be applied

    doAfterTry hook

    MyGame.createAsset({
      class: "Thing",
      name: "This Asset",
      dov: {
        jump: {
          doAfterTry: function( params )
          {
            let msg = `You just tried to jump ${this.articlename}! `;
            this.game.print(msg);
            return;
          },
        },
      },
    });

    doBeforeSuccess hook

    MyGame.createAsset({
      class: "Thing",
      name: "This Asset",
      dov: {
        jump: {
          doBeforeSuccess: function( params )
          {
            let msg = `You're about to succeed in performing jump on ${this.articlename}. `;
            this.game.print(msg);
            return;
          },
        },
      },
    });

    doSuccess handles state changes and printing messages

    doAfterSuccess hook

    MyGame.createAsset({
      class: "Thing",
      name: "This Asset",
      dov: {
        jump: {
          doAfterSuccess: function( params )
          {
            let msg = `You succeeded in performing jump on ${this.articlename}. `;
            this.game.print(msg);
            return;
          },
        },
      },
    });
Expand for example

Assets must have separate direct and indirect verb subscriptions. Consider this singing sword, which is directly subscribed to the verb "take". We want our game to print a custom message when the player tries to take the sword, and a different message when the player succeeds in taking it.

MyGame.createAsset({
  class: "Sword",
  name: "singing sword",
  dov: {
    take: 
    {
      doAfterTry: function()
      {
        let msg = "The sword begins to vibrate as your hand curls around its haft. ";
        MyGame.print( msg );
      },
      doAfterSuccess: function()
      {
        let msg = "The sword bursts into song in your hand. ";
        MyGame.print( msg );
      },
    },
  },
});

Now consider this stone, which is indirectly subscribed to "remove". We want to print messages when the sword is removed from it, so we'll hook into the stone's indirect object subscription. We could put this code on either object. A case like this comes down to author's choice.

MyGame.createAsset({
  class: "Thing",
  name: "stone",
  iov: {
    remove: 
    {
      doBeforeTry: function()
      {
        let msg = "Will the stone judge you worthy enough to remove the sword? "
        MyGame.print( msg );
      },
      doAfterSuccess: function()
      {
        let msg = "With the sword removed, the stone bursts into rubble! ";
        MyGame.print( msg );
        this.destroy();
      },      
    },
  },
});

Notes

jump action hooks

Every asset referred to in the turn's input is checked for verb action hooks. These hooks allow authors to inject custom code or print custom text during verb operations. There are two distinct approaches to defining verb actions, designed to accommodate different levels of scripting experience. Authors may use whichever approach they find most comfortable. For more details, see Action Hooks.

  1. Simple approach: Define string properties such as asset.do_jump. If AdventureJS finds a string, it prints it instead of the default output for that turn. This option is best for authors who want to customize output without writing code.
  2. Advanced approach: Define method properties such as asset.doJump(). If a method is found, it is called with a parameter object containing any relevant assets from the input (e.g., asset.doJump({asset1,asset2}) ). The author may use or ignore these parameters. This approach offers complete control over the turn’s outcome: authors can add conditional logic, force success or failure, or revise the default output.

String properties

Expand any item to see code examples.

try_jump

Called on every object in the input, including the player character, regardless of prepositions or sentence structure.

MyGame.createAsset({
  class: "Thing",
  name: "Thing One",
  try_jump: "Found custom string at thing_one.try_jump",
});
do_jump

Called on every object in the input, including the player character, regardless of prepositions or sentence structure.

MyGame.createAsset({
  class: "Thing",
  name: "Thing One",
  do_jump: "Found custom string at thing_one.do_jump",
});
try_jump_this

Called on This asset in a phrase such as "jump this". Since no indirect object is given, we treat the player character as an indirect object.

  1. In this example, we set the value of the top level object key to a string. This variation results in the same response regardless of which player character uses the verb.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      try_jump_this: "Found custom string at thing_one.try_jump_this",
    });
    
  2. In this example, we use the name of a player character asset as a nested object key. This variation results in a singular response only when that particular player character uses the verb on this asset.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      try_jump_this: {
        "Player Two": "Found custom string at thing_one.try_jump_this['Player Two']",
      },
    });
    
do_jump_this

Called on This asset in a phrase such as "jump this". Since no indirect object is given, we treat the player character as an indirect object.

  1. In this example, we set the value of the top level object key to a string. This variation results in the same response regardless of which player character uses the verb.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      do_jump_this: "Found custom string at thing_one.do_jump_this",
    });
    
  2. In this example, we use the name of a player character asset as a nested object key. This variation results in a singular response only when that particular player character uses the verb on this asset.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      do_jump_this: {
        "Player Two": "Found custom string at thing_one.do_jump_this['Player Two']",
      },
    });
    
try_jump_preposition_this

Called on This asset in a phrase such as "jump this". Since no indirect object is given, we treat the player character as an indirect object.

  1. In this example, we set the value of the top level object key to a string. This variation results in the same response regardless of which player character uses the verb.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      try_jump_with_this: "Found custom string at thing_one.try_jump_with_this",
    });
    
  2. In this example, we use the name of a player character asset as a nested object key. This variation results in a singular response only when that particular player character uses the verb on this asset.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      try_jump_with_this: {
        "Player Two": "Found custom string at thing_one.try_jump_with_this['Player Two']",
      },
    });
    
do_jump_preposition_this

Called on This asset in a phrase such as "jump this". Since no indirect object is given, we treat the player character as an indirect object.

  1. In this example, we set the value of the top level object key to a string. This variation results in the same response regardless of which player character uses the verb.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      do_jump_with_this: "Found custom string at thing_one.do_jump_with_this",
    });
    
  2. In this example, we use the name of a player character asset as a nested object key. This variation results in a singular response only when that particular player character uses the verb on this asset.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      do_jump_with_this: {
        "Player Two": "Found custom string at thing_one.do_jump_with_this['Player Two']",
      },
    });
    
try_jump_this_that

Called on This asset in a phrase such as "jump this that", where This is the direct object and That is the indirect object.

try_jump_this_that mirrors try_jump_that_this. One is called on a direct object; the other on an indirect object. These are equivalent, and you may place code on whichever asset makes sense to you.

  1. In this example, we set the value of the top level object key to a string. This variation results in the same response regardless of what That asset is.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      try_jump_this_that: "Found custom string at thing_one.try_jump_this_that",
    });
    
  2. In this example, we use the name of an asset as a nested object key. This variation results in a singular response for That particular asset.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      try_jump_this_that: {
        "Thing Two": "Found custom string at thing_one.try_jump_this_that['Thing Two']",
      },
    });
    
do_jump_this_that

Called on This asset in a phrase such as "jump this that", where This is the direct object and That is the indirect object.

do_jump_this_that mirrors do_jump_that_this. One is called on a direct object; the other on an indirect object. These are equivalent, and you may place code on whichever asset makes sense to you.

  1. In this example, we set the value of the top level object key to a string. This variation results in the same response regardless of what That asset is.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      do_jump_this_that: "Found custom string at thing_one.do_jump_this_that",
    });
    
  2. In this example, we use the name of an asset as a nested object key. This variation results in a singular response for That particular asset.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      do_jump_this_that: {
        "Thing Two": "Found custom string at thing_one.do_jump_this_that['Thing Two']",
      },
    });
    
try_jump_that_this

Called on That asset in a phrase such as "jump this that".

try_jump_that_this mirrors try_jump_this_that. One is called on an indirect object; the other on a direct object. These are equivalent, and you may place code on whichever asset makes sense to you.

  1. In this example, we set the value of the top level object key to a string. This variation results in the same response regardless of what That asset is.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing Two",
      try_jump_that_this: "Found custom string at thing_two.try_jump_that_this",
    });
    
  2. In this example, we use the name of an asset as a nested object key. This variation results in a singular response for That particular asset.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing Two",
      try_jump_that_this: {
        "Thing One": "Found custom string at thing_two.try_jump_that_this['Thing One']",
      },
    });
    
do_jump_that_this

Called on That asset in a phrase such as "jump this that".

do_jump_that_this mirrors do_jump_this_that. One is called on an indirect object; the other on a direct object. These are equivalent, and you may place code on whichever asset makes sense to you.

  1. In this example, we set the value of the top level object key to a string. This variation results in the same response regardless of what That asset is.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing Two",
      do_jump_that_this: "Found custom string at thing_two.do_jump_that_this",
    });
    
  2. In this example, we use the name of an asset as a nested object key. This variation results in a singular response for That particular asset.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing Two",
      do_jump_that_this: {
        "Thing One": "Found custom string at thing_two.do_jump_that_this['Thing One']",
      },
    });
    
try_jump_preposition_this_preposition_that

Called on This asset in a phrase such as "jump from this to that", where This is the direct object and That is the indirect object.

try_jump_preposition_this_preposition_that mirrors try_jump_preposition_that_preposition_this. One is called on a direct object; the other on an indirect object. These are equivalent, and you may place code on whichever asset makes sense to you.

This example uses "from" and "to" as the prepositions, but any prepositions can set unique responses.

  1. In this example, we set the value of the top level object key to a string. This variation results in the same response regardless of what This is moved to.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      try_jump_from_this_to_that: "Found custom string at thing_one.try_jump_from_this_to_that",
    });
    
  2. In this example, we use the name of an asset as a nested object key. This variation results in a singular response when This is moved to That particular asset.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      try_jump_from_this_to_that: {
        "Thing Two": "Found custom string at thing_one.try_jump_from_this_to_that['Thing Two']",
      },
    });
    
do_jump_preposition_this_preposition_that

Called on This asset in a phrase such as "jump from this to that", where This is the direct object and That is the indirect object.

do_jump_preposition_this_preposition_that mirrors dojump_preposition_that_preposition_this. One is called on a direct object; the other on an indirect object. These are equivalent, and you may place code on whichever asset makes sense to you.

This example uses "from" and "to" as the prepositions, but any prepositions can set unique responses.

  1. In this example, we set the value of the top level object key to a string. This variation results in the same response regardless of what This is moved to.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      do_jump_from_this_to_that: "Found custom string at thing_one.do_jump_from_this_to_that",
    });
    
  2. In this example, we use the name of an asset as a nested object key. This variation results in a singular response when This is moved to That particular asset.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      do_jump_from_this_to_that: {
        "Thing Two": "Found custom string at thing_one.do_jump_from_this_to_that['Thing Two']",
      },
    });
    
try_jump_preposition_that_preposition_this

Called on That asset in a phrase such as "jump from this to that", where That is the indirect object and This is the direct object.

try_jump_preposition_that_preposition_this mirrors try_jump_preposition_this_preposition_that. One is called on an indirect object; the other on a direct object. These are equivalent, and you may place code on whichever asset makes sense to you.

This example uses "from" and "to" as the prepositions, but any prepositions can set unique responses.

  1. In this example, we set the value of the top level object key to a string. This variation results in the same response regardless of what This asset is.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing Two",
      try_jump_from_that_to_this: "Found custom string at thing_two.try_jump_from_that_to_this",
    });
    
  2. In this example, we use the name of an asset as a nested object key. This variation results in a singular response for This particular asset.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing Two",
      try_jump_from_that_to_this: {
        "Thing One": "Found custom string at thing_two.try_jump_from_that_to_this['Thing One']",
      },
    });
    
do_jump_preposition_that_preposition_this

Called on That asset in a phrase such as "jump from this to that", where That is the indirect object and This is the direct object.

do_jump_preposition_that_preposition_this mirrors do_jump_preposition_this_preposition_that. One is called on an indirect object; the other on a direct object. These are equivalent, and you may place code on whichever asset makes sense to you.

This example uses "from" and "to" as the prepositions, but any prepositions can set unique responses.

  1. In this example, we set the value of the top level object key to a string. This variation results in the same response regardless of what This asset is.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing Two",
      do_jump_from_that_to_this: "Found custom string at thing_two.do_jump_from_that_to_this",
    });
    
  2. In this example, we use the name of an asset as a nested object key. This variation results in a singular response for This particular asset.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing Two",
      do_jump_from_that_to_this: {
        "Thing One": "Found custom string at thing_two.do_jump_from_that_to_this['Thing One']",
      },
    });
    

Method properties

Expand any item to see code examples. Methods are called with a parameter object in the form of action({asset1, asset2, params}) which authors may use or ignore.

tryJump

Called on every object in the input, including the player character, regardless of prepositions or sentence structure.

MyGame.createAsset({
  class: "Player",
  name: "Player One",
  tryJump: function (params) {
    let msg = "Found custom method at player_one.tryJump()";
    MyGame.print(msg);
  },
});
doJump

Called on every object in the input, including the player character, regardless of prepositions or sentence structure.

MyGame.createAsset({
  class: "Player",
  name: "Player One",
  doJump: function (params) {
    let msg = "Found custom method at player_one.doJump()";
    MyGame.print(msg);
  },
});
tryJumpThis

Called on This asset in a phrase such as "jump this". Since no indirect object is given, we treat the player character as an indirect object.

  1. In this example, we ignore the passed parameter. This variation results in the same response regardless of which player character uses the verb.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      tryJumpThis: function () {
        let msg = "Found custom method at thing_one.tryJumpThis()";
        MyGame.print(msg);
      },
    });
    
  2. To limit the method to act only on a certain asset, change the value of tryJumpThis from a method to an object, use the asset's name as a key on the object, and set that key's value to a method instead.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      tryJumpThis: {
        "Player Two": function () {
          let msg = "Found custom method at thing_one.tryJumpThis['Player Two']()";
          MyGame.print(msg);
        },
      },
    });
    
  3. Finally, in this example, we apply per-asset logic based on the value of asset1, which is available via our passed parameter. In this particular verb action, asset1 is the player character, because we've treated it as the indirect object in absence of a player specified object.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      tryJumpThis: function ({asset1}) {
        switch (asset1.name) {
          case "Player Two":
            let msg = "Found custom method at thing_one.tryJumpThis('Player Two')";
            MyGame.print(msg);
            break;
          default:
            // do nothing and allow the default result
            break;
        }
        return;
      },
    });
    
doJumpThis

Called on This asset in a phrase such as "jump this". Since no indirect object is given, we treat the player character as an indirect object.

  1. In this example, we ignore the passed parameter. This variation results in the same response regardless of which player character uses the verb.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      doJumpThis: function () {
        let msg = "Found custom method at thing_one.doJumpThis()";
        MyGame.print(msg);
      },
    });
    
  2. To limit the method to act only on a certain asset, change the value of doJumpThis from a method to an object, use the asset's name as a key on the object, and set that key's value to a method instead.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      doJumpThis: {
        "Player Two": function () {
          let msg = "Found custom method at thing_one.doJumpThis['Player Two']()";
          MyGame.print(msg);
        },
      },
    });
    
  3. Finally, in this example, we apply per-asset logic based on the value of asset1, which is available via our passed parameter. In this particular verb action, asset1 is the player character, because we've treated it as the indirect object in absence of a player specified object.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      doJumpThis: function ({asset1}) {
        switch (asset1.name) {
          case "Player Two":
            let msg = "Found custom method at thing_one.doJumpThis('Player Two')";
            MyGame.print(msg);
            break;
          default:
            // do nothing and allow the default result
            break;
        }
        return;
      },
    });
    
tryJumpPrepositionThis

Called on This asset in a phrase such as "jump on this". Since no indirect object is given, we treat the player character as an indirect object. This example uses "with" as the preposition, but any preposition can set a unique response.

  1. In this example, we ignore the passed parameter. This variation results in the same response regardless of which player character uses the verb.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      tryJumpWithThis: function () {
        let msg = "Found custom method at thing_one.tryJumpWithThis()";
        MyGame.print(msg);    
      },
    });
    
  2. To limit the method to act only on a certain asset, change the value of tryJumpPrepositionThis from a method to an object, use the asset's name as a key on the object, and set that key's value to a method instead.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      tryJumpWithThis: {
        "Player Two": function () {
          let msg = "Found custom method at thing_one.tryJumpWithThis['Player Two']()";
          MyGame.print(msg);
        },
      },
    });
    
  3. Finally, in this example, we apply per-asset logic based on the value of asset1, which is available via our passed parameter. In this particular verb action, asset1 is the player character, because we've treated it as the indirect object in absence of a player specified object.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      tryJumpWithThis: function ({asset1}) {
        switch (asset1.name) {
          case "Player Two":
            let msg = "Found custom method at thing_one.tryJumpWithThis('Player Two')";
            MyGame.print(msg);
            break;
          default:
            // do nothing and allow the default result
            break;
        }
        return;
      },
    });
    
doJumpPrepositionThis

Called on This asset in a phrase such as "jump on this". Since no indirect object is given, we treat the player character as an indirect object. This example uses "with" as the preposition, but any preposition can set a unique response.

Note that sentence structures are commonly mutated during the doTry verb phase, so try and do may act on different sentence structures.

  1. In this example, we ignore the passed parameter. This variation results in the same response regardless of which player character uses the verb.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      doJumpWithThis: function () {
        let msg = "Found custom method at thing_one.doJumpWithThis()";
        MyGame.print(msg);    
      },
    });
    
  2. To limit the method to act only on a certain asset, change the value of doJumpPrepositionThis from a method to an object, use the asset's name as a key on the object, and set that key's value to a method instead.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      doJumpWithThis: {
        "Player Two": function () {
          let msg = "Found custom method at thing_one.doJumpWithThis['Player Two']()";
          MyGame.print(msg);
        },
      },
    });
    
  3. Finally, in this example, we apply per-asset logic based on the value of asset1, which is available via our passed parameter. In this particular verb action, asset1 is the player character, because we've treated it as the indirect object in absence of a player specified object.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      doJumpWithThis: function ({asset1}) {
        switch (asset1.name) {
          case "Player Two":
            let msg = "Found custom method at thing_one.doJumpWithThis('Player Two')";
            MyGame.print(msg);
            break;
          default:
            // do nothing and allow the default result
            break;
        }
        return;
      },
    });
    
tryJumpThisThat

Called on This asset in a phrase such as "jump this that".

tryJumpThisThat mirrors tryJumpThatThis. One is called on a direct object; the other on an indirect object. These are equivalents. Where you place your code is a matter of preference.

  1. In this example, we ignore the passed parameter. This variation results in the same response regardless of what That asset is.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      tryJumpThisThat: function () {
        let msg = "Found custom method at thing_one.tryJumpThisThat()";
        MyGame.print(msg);
      },
    });
    
  2. To limit the method to act only on a certain asset, change the value of tryJumpThisThat from a method to an object, use the asset's name as a key on the object, and set that key's value to a method instead.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      tryJumpThisThat: { 
        "Thing Two": function (params) {
          let msg = "Found custom method at thing_one.tryJumpThisThat['Second Thing']()";
          MyGame.print(msg);
        }
      },
    });
    
  3. Finally, in this example, we apply per-asset logic based on the value of asset1, which is available via our passed parameter. In this verb action, asset1 is the second noun.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      tryJumpThisThat: function ({asset1}) {
        switch (asset1.name) {
          case "Thing Two":
            let msg = "Found custom method at thing_one.tryJumpThisThat('Second Thing')";
            MyGame.print(msg);
            break;
          default:
            // do nothing and allow the default result
            break;
        }
        return;
      },
    });
    
doJumpThisThat

Called on This asset in a phrase such as "jump this that". doJumpThisThat mirrors doJumpThatThis. One is called on a direct object; the other on an indirect object. These are equivalent, and you may place code on whichever asset makes sense to you.

  1. In this example, we ignore the passed parameter. This variation results in the same response regardless of what That asset is.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      doJumpThisThat: function () {
        let msg = "Found custom method at thing_one.doJumpThisThat()";
        MyGame.print(msg);
      },
    });
    
  2. To limit the method to act only on a certain asset, change the value of doJumpThisThat from a method to an object, use the asset's name as a key on the object, and set that key's value to a method instead.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      doJumpThisThat: { 
        "Thing Two": function (params) {
          let msg = "Found custom method at thing_one.doJumpThisThat['Second Thing']()";
          MyGame.print(msg);
        }
      },
    });
    
  3. Finally, in this example, we apply per-asset logic based on the value of asset1, which is available via our passed parameter. In this verb action, asset1 is the second noun.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      doJumpThisThat: function ({asset1}) {
        switch (asset1.name) {
          case "Thing Two":
            let msg = "Found custom method at thing_one.doJumpThisThat('Second Thing')";
            MyGame.print(msg);
            break;
          default:
            // do nothing and allow the default result
            break;
        }
        return;
      },
    });
    
tryJumpThatThis

Called on That asset in a phrase such as "jump this that".

tryJumpThatThis mirrors tryJumpThisThat. One is called on an indirect object; the other on a direct object. These are equivalents. Where you place your code is a matter of preference.

  1. In this example, we ignore the passed parameter. This variation results in the same response regardless of what That asset is.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      tryJumpThatThis: function () {
        let msg = "Found custom method at thing_one.tryJumpThatThis()";
        MyGame.print(msg);
      },
    });
    
  2. To limit the method to act only on a certain asset, change the value of tryJumpThatThis from a method to an object, use the asset's name as a key on the object, and set that key's value to a method instead.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing Two",
      tryJumpThatThis: { 
        "Thing One": function (params) {
          let msg = "Found custom method at thing_two.tryJumpThatThis['First Thing']()";
          MyGame.print(msg);
        }
      },
    });
    
  3. Finally, in this example, we apply per-asset logic based on the value of asset1, which is available via our passed parameter. In this verb action, asset1 is the second noun.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing Two",
      tryJumpThatThis: function ({asset1}) {
        switch (asset1.name) {
          case "Thing One":
            let msg = "Found custom method at thing_two.tryJumpThatThis('First Thing')";
            MyGame.print(msg);
            break;
          default:
            // do nothing and allow the default result
            break;
        }
        return;
      },
    });
    
doJumpThatThis

Called on That asset in a phrase such as "jump this that".

doJumpThatThis mirrors doJumpThisThat. One is called on an indirect object; the other on a direct object. These are equivalent, and you may place code on whichever asset makes sense to you.

  1. In this example, we ignore the passed parameter. This variation results in the same response regardless of what That asset is.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      doJumpThatThis: function () {
        let msg = "Found custom method at thing_one.doJumpThatThis()";
        MyGame.print(msg);
      },
    });
    
  2. To limit the method to act only on a certain asset, change the value of doJumpThatThis from a method to an object, use the asset's name as a key on the object, and set that key's value to a method instead.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing Two",
      doJumpThatThis: { 
        "Thing One": function (params) {
          let msg = "Found custom method at thing_two.doJumpThatThis['First Thing']()";
          MyGame.print(msg);
        }
      },
    });
    
  3. Finally, in this example, we apply per-asset logic based on the value of asset1, which is available via our passed parameter. In this verb action, asset1 is the second noun.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing Two",
      doJumpThatThis: function ({asset1}) {
        switch (asset1.name) {
          case "Thing One":
            let msg = "Found custom method at thing_two.doJumpThatThis('First Thing')";
            MyGame.print(msg);
            break;
          default:
            // do nothing and allow the default result
            break;
        }
        return;
      },
    });
    
tryJumpPrepositionThisPrepositionThat

Called on This asset in a phrase such as "jump from this to that", where This is the direct object and That is the indirect object.

tryJumpPrepositionThisPrepositionThat mirrors tryJumpPrepositionThatPrepositionThis. One is called on a direct object; the other on an indirect object. These are equivalent, and you may place code on whichever asset makes sense to you.

This example uses "from" and "to" as the prepositions, but any prepositions can set unique responses.

  1. In this example, we ignore the passed parameter. This variation results in the same response regardless of what That asset is.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      tryJumpFromThisToThat: function () {
        let msg = "Found custom method at thing_one.tryJumpFromThisToThat()";
        MyGame.print(msg);    
      },
    });
    
  2. To limit the method to act only on a certain asset, change the value of tryJumpPrepositionThisPrepositionThat from a method to an object, use the asset's name as a key on the object, and set that key's value to a method instead.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      tryJumpFromThisToThat: { 
        "Thing Two": function (params) {
          let msg = "Found custom method at thing_one.tryJumpFromThisToThat['Second Thing']()";
          MyGame.print(msg);
        }
      },
    });
    
  3. Finally, in this example, we apply per-asset logic based on the value of asset1, which is available via our passed parameter. In this verb action, asset1 is the second noun.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      tryJumpFromThisToThat: function ({asset1}) {
        switch (asset1.name) {
          case "Thing Two":
            let msg = "Found custom method at thing_one.tryJumpFromThisToThat('Second Thing')";
            MyGame.print(msg);
            break;
          default:
            // do nothing and allow the default result
            break;
        }
        return;
      },
    });
    
doJumpPrepositionThisPrepositionThat

Called on This asset in a phrase such as "jump from this to that", where This is the direct object and That is the indirect object.

doJumpPrepositionThisPrepositionThat mirrors doJumpPrepositionThatPrepositionThis. One is called on a direct object; the other on an indirect object. These are equivalent, and you may place code on whichever asset makes sense to you.

This example uses "from" and "to" as the prepositions, but any prepositions can set unique responses.

  1. In this example, we ignore the passed parameter. This variation results in the same response regardless of what That asset is.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      doJumpFromThisToThat: function () {
        let msg = "Found custom method at thing_one.doJumpFromThisToThat()";
        MyGame.print(msg);    
      },
    });
    
  2. To limit the method to act only on a certain asset, change the value of doJumpPrepositionThisPrepositionThat from a method to an object, use the asset's name as a key on the object, and set that key's value to a method instead.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      doJumpFromThisToThat: { 
        "Thing Two": function (params) {
          let msg = "Found custom method at thing_one.doJumpFromThisToThat['Second Thing']()";
          MyGame.print(msg);
        }
      },
    });
    
  3. Finally, in this example, we apply per-asset logic based on the value of asset1, which is available via our passed parameter. In this verb action, asset1 is the second noun.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing One",
      doJumpFromThisToThat: function ({asset1}) {
        switch (asset1.name) {
          case "Thing Two":
            let msg = "Found custom method at thing_one.doJumpFromThisToThat('Second Thing')";
            MyGame.print(msg);
            break;
          default:
            // do nothing and allow the default result
            break;
        }
        return;
      },
    });
    
tryJumpPrepositionThatPrepositionThis

Called on That asset in a phrase such as "jump from this to that", where This is the direct object and That is the indirect object.

tryJumpPrepositionThatPrepositionThis mirrors tryJumpPrepositionThisPrepositionThat. One is called on an indirect object; the other on a direct object. These are equivalent, and you may place code on whichever asset makes sense to you.

This example uses "to" and "from" as the prepositions, but any prepositions can set unique responses.

  1. In this example, we ignore the passed parameter. This variation results in the same response regardless of what That asset is.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing Two",
      tryJumpToThatFromThis: function () {
        let msg = "Found custom method at thing_two.tryJumpToThatFromThis()";
        MyGame.print(msg);    
      },
    });
    
  2. To limit the method to act only on a certain asset, change the value of tryJumpPrepositionThatPrepositionThis from a method to an object, use the asset's name as a key on the object, and set that key's value to a method instead.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing Two",
      tryJumpToThatFromThis: { 
        "Thing One": function (params) {
          let msg = "Found custom method at thing_two.tryJumpToThatFromThis['First Thing']()";
          MyGame.print(msg);
        }
      },
    });
    
  3. Finally, in this example, we apply per-asset logic based on the value of asset1, which is available via our passed parameter. In this verb action, asset1 is the second noun.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing Two",
      tryJumpToThatFromThis: function ({asset1}) {
        switch (asset1.name) {
          case "Thing One":
            let msg = "Found custom method at thing_two.tryJumpToThatFromThis('First Thing')";
            MyGame.print(msg);
            break;
          default:
            // do nothing and allow the default result
            break;
        }
        return;
      },
    });
    
doJumpPrepositionThatPrepositionThis

Called on That asset in a phrase such as "jump from this to that", where This is the direct object and That is the indirect object.

doJumpPrepositionThatPrepositionThis mirrors doJumpPrepositionThisPrepositionThat. One is called on an indirect object; the other on a direct object. These are equivalent, and you may place code on whichever asset makes sense to you.

This example uses "to" and "from" as the prepositions, but any prepositions can set unique responses.

  1. In this example, we ignore the passed parameter. This variation results in the same response regardless of what That asset is.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing Two",
      doJumpToThatFromThis: function () {
        let msg = "Found custom method at thing_two.doJumpToThatFromThis()";
        MyGame.print(msg);    
      },
    });
    
  2. To limit the method to act only on a certain asset, change the value of doJumpPrepositionThatPrepositionThis from a method to an object, use the asset's name as a key on the object, and set that key's value to a method instead.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing Two",
      doJumpToThatFromThis: { 
        "Thing One": function (params) {
          let msg = "Found custom method at thing_two.doJumpToThatFromThis['First Thing']()";
          MyGame.print(msg);
        }
      },
    });
    
  3. Finally, in this example, we apply per-asset logic based on the value of asset1, which is available via our passed parameter. In this verb action, asset1 is the second noun.
    MyGame.createAsset({
      class: "Thing",
      name: "Thing Two",
      doJumpToThatFromThis: function ({asset1}) {
        switch (asset1.name) {
          case "Thing One":
            let msg = "Found custom method at thing_two.doJumpToThatFromThis('First Thing')";
            MyGame.print(msg);
            break;
          default:
            // do nothing and allow the default result
            break;
        }
        return;
      },
    });
    

Notes

  • Verb action hooks are specific to their particular verb.
  • Which verb action hooks are called depends on the structure of the player's input. Hooks are checked for every asset in the input, including the player character. Which hooks are called depends on the sentence structure of the player's input:
    1. Single-object input (e.g., "jump this"): The hook is called on This asset. Since no indirect object is specified, the player character is treated as an indirect object.
    2. Multiple-object input (e.g., "jump this with that"): The hook is called depending on the object’s role in the phrase. do_jump_this_preposition_that runs on This direct object, while do_jump_that_preposition_this runs on That indirect object. These are equivalent, and you may place code on whichever asset makes sense to you. Any preposition can be used to define a unique response, for example jump with vs jump on.
  • Sentence structures are commonly mutated during the doTry verb phase, so try and do may act on different sentence structures.
  • Verb actions are extremely granular and depend on specific combinations of assets and prepositions. Verb actions are called during a verb's doTry and doSuccess phases, which lets them override a verb's operations. Use them if you want to customize output for specific inputs, but beware of that granularity. Consider doTake(): it's called when a player takes an asset, so you might want to hook into that; but many other verbs may also move the asset into the player. If you want to catch any method that moves an asset into the player, you may find the do_move_this_to_that verb reaction more broadly applicable.
  • By default, string properties override a turn's output, but they can also be set to append or prepend the turn's default output. See verb action hooks for more information.
  • Verb reaction hooks are functionally the same as action hooks. The only difference is that reaction hooks are not specific to any verb.
  • Verb phase hooks are a different form of hook that allows authors to override entire verb phases.

jump reaction hooks

Every asset affected by the turn is checked for verb reaction hooks. These hooks allow authors to inject custom code or print custom text during verb operations. There are two distinct approaches to defining verb reactions, designed to accommodate different levels of scripting experience. Authors may use whichever approach they find most comfortable. See verb reaction hooks for details.

  1. Simple approach: Define string properties (e.g., asset.do_move_this_to_that). If AdventureJS finds a string, it prints it instead of the default output for that turn. This option is best for authors who want to customize output without writing code.
  2. Advanced approach: Define method properties (e.g., asset.doMoveThisToThat() ). If a method is found, it is called with a parameter object containing any relevant assets from the input (e.g., asset.doMoveThisToThat({asset1}) ). The author may use or ignore these parameters. This approach offers complete control over the turn’s outcome: authors can add conditional logic, force success or failure, or revise the default output.

String properties

Expand any item to see code examples. By default, string properties override a turn's output, but they can also be set to append or prepend output.

do_remove_this_from_that

Overrides the turn's output when This Tangible asset when it is removed from That Tangible asset.

  1. In this example, we set the value of the top level object key to a string. This variation results in the same response regardless of what This is removed from.
    MyGame.createAsset({
    class: "Dagger",
    name: "Jeweled Dagger",
    do_remove_this_from_that: "The jeweled dagger slides free. ",
    });
    
  2. In this example, we use the name of an asset as a nested object key. This variation results in a singular response when This is removed from That particular asset.
    MyGame.createAsset({
      class: "Dagger",
      name: "Jeweled Dagger",
      do_remove_this_from_that: {
        "Leather Scabbard": "The jeweled dagger slides free of the leather scabbard. ",
      },
    });
    
do_remove_that_from_this

Overrides the turn's output when That Tangible asset is removed from This Tangible asset.

  1. In this example, we set the value of the top level object key to a string. This variation results in the same response regardless of what is removed from This.
    MyGame.createAsset({
      class: "Chest",
      name: "Ornate Chest",
      do_remove_that_from_this: "The chest snaps at you! ",
    });
    
  2. In this example, we use the name of an asset as a nested object key. This variation results in a singular response when This is removed from That particular asset.
    MyGame.createAsset({
      class: "Chest",
      name: "Ornate Chest",
      do_remove_that_from_this: {
        "Leather Scabbard": "The ornate chest snaps at you when you remove the leather scabbard from it. ",
      },
    });
    
do_move_this_to_that

Overrides the turn's output when This Tangible asset is moved to That Tangible asset.

  1. In this example, we set the value of the top level object key to a string. This variation results in the same response regardless of what This is moved to.
    MyGame.createAsset({
      class: "Torch",
      name: "burning brand",
      do_move_this_to_that: "The burning brand scorches its surroundings. ",
    });
    
  2. In this example, we use the name of an asset as a nested object key. This variation results in a singular response when This is moved to That particular asset.
    MyGame.createAsset({
      class: "Torch",
      name: "burning brand",
      do_move_this_to_that: {
        "funeral pyre": "The pyre bursts into flame! ",
      },
    });
    
do_move_that_to_this

Overrides the turn's output when That Tangible asset is moved to This Tangible asset.

  1. In this example, we set the value of the top level object key to a string. This variation results in the same response regardless of what That is moved to This.
    MyGame.createAsset({
      class: "Chest",
      name: "Ornate Chest",
      do_move_that_to_this: "The chest snaps at you but accepts your offering. ",
    });
    
  2. In this example, we use the name of an asset as a nested object key. This variation results in a singular response when That particular asset is moved to This.
    MyGame.createAsset({
      class: "Chest",
      name: "Ornate Chest",
      do_move_that_to_this: {
        "Golden Idol": "The ornate chest accepts the golden idol and belches loudly. ",
      },
    });
    

Method properties

Expand any item to see code examples. All methods are called with a parameter object in the form of asset.reaction({asset1, asset2, params}) which authors may use or ignore.

doRemoveThisFromThat

Called on This Tangible asset when it is removed from That Tangible asset.

  1. In this example, we ignore the passed parameter. This variation results in the same response regardless of what This is removed from.
    MyGame.createAsset({
      class: "Dagger",
      name: "Jeweled Dagger",
      doRemoveThisFromThat: function () {
        let msg = "The jeweled dagger slides free. ";
        MyGame.overrideOutput(msg);
      },
    });
    
  2. To limit the method to removing This from a certain That, you can change the value of doRemoveThisFromThat from a method to an object, use That asset name as a key on the object, and set that key's value to a method instead.
    MyGame.createAsset({
      class: "Dagger",
      name: "Jeweled Dagger",
      doRemoveThisFromThat: {
        "Leather Scabbard": function () {
          let msg = "The jeweled dagger slides free from the leather scabbard. ";
          MyGame.overrideOutput(msg);
        },
      },
    });
    
  3. Finally, in this example, we apply per-asset logic based on the value of asset1, which is available via our passed parameter.
    MyGame.createAsset({
      class: "Dagger",
      name: "Jeweled Dagger",
      doRemoveThisFromThat: function ({asset1}) {
        switch (asset1.name) {
          case "Leather Scabbard":
            let msg = "The jeweled dagger slides smoothly from the leather scabbard. ";
            MyGame.overrideOutput(msg)
            break;
          default:
            // do nothing and allow the default result
            break;
        }
        return;
      },
    });
    
doRemoveThatFromThis

Called on This Tangible asset when That Tangible asset is removed from it.

  1. In this example, we ignore the passed parameter. This variation results in the same response regardless of which That is removed from This.
    MyGame.createAsset({
      class: "Chest",
      name: "Ornate Chest",
      doRemoveThatFromThis: function () {
        let msg = "The chest snaps at you! ";
        MyGame.overrideOutput(msg);
      },
    });
    
  2. To limit the method to act only when removing a certain That from This, you can change the value of doRemoveThisFromThat from a method to an object, use That asset name as a key on the object, and set that key's value to a method instead.
    MyGame.createAsset({
      class: "Chest",
      name: "Ornate Chest",
      doRemoveThatFromThis: {
        "Leather Scabbard": function () {
          let msg = "The ornate chest snaps at you when you remove the leather scabbard from it. ";
          MyGame.overrideOutput(msg);
        },
      },
    });
    
  3. Finally, in this example, we apply per-asset logic based on the value of asset1, which is available via our passed parameter.
    MyGame.createAsset({
      class: "Chest",
      name: "Ornate Chest",
      doRemoveThatFromThis: function ({asset1}) {
        switch (asset1.name) {
          case "Leather Scabbard":
            let msg = "The ornate chest quivers at you when you remove the leather scabbard from it. ";
            MyGame.overrideOutput(msg)
            break;
          default:
            // do nothing and allow the default result
            break;
        }
        return;
      },
    });
    
doMoveThisToThat

Called on This Tangible asset when it is moved to That Tangible asset.

  1. In this example, we ignore the passed parameter. This variation results in the same response regardless of what This is moved to.
    MyGame.createAsset({
      class: "Torch",
      name: "burning brand",
      doMoveThisToThat: function () {
        let msg = "The burning brand scorches its surroundings. ";
        MyGame.appendOutput(msg);
      },
    });
    
  2. To limit the method to act only when moving This to a certain That, you can change the value of doMoveThisToThat from a method to an object, use That asset name as a key on the object, and set that key's value to a method instead.
    MyGame.createAsset({
      class: "Torch",
      name: "burning brand",
      doMoveThisToThat: {
        "funeral pyre": function () {
          let msg = "The pyre bursts into flame! ";
          // add logic to change state of pyre
          MyGame.appendOutput(msg);
        },
      },
    });
    
  3. Finally, in this example, we apply per-asset logic based on the value of asset1, which is available via our passed parameter.
    MyGame.createAsset({
      class: "Torch",
      name: "burning brand",
      doMoveThisToThat: function ({asset1}) {
        switch (asset1.name) {
          case "funeral pyre":
            let msg = "The pyre bursts into flame! ";
            // add logic to change state of pyre
            MyGame.appendOutput(msg);
            break;
          default:
            // do nothing and allow the default result
            break;
        }
        return;
      },
    });
    
doMoveThatToThis

Called on a Tangible asset when another asset is moved to it. Called on This Tangible asset when That Tangible asset is moved to it.

  1. In this example, we ignore the passed parameter. This variation results in the same response regardless of which That is moved to This.
    MyGame.createAsset({
      class: "Chest",
      name: "Ornate Chest",
      doMoveThatToThis: function () {
        let msg = "The chest snaps at you but accepts your offering. ";
        MyGame.overrideOutput(msg);
      },
    });
    
  2. To limit the method to act only when moving a certain That to This, you can change the value of doMoveThatToThis from a method to an object, use That asset name as a key on the object, and set that key's value to a method instead.
    MyGame.createAsset({
      class: "Chest",
      name: "Ornate Chest",
      doMoveThatToThis: {
        "Golden Idol": function () {
          let msg = "The ornate chest accepts the golden idol and belches loudly. ";
          MyGame.overrideOutput(msg);
        },
      },
    });
    
  3. Finally, in this example, we apply per-asset logic based on the value of asset1, which is available via our passed parameter.
    MyGame.createAsset({
      class: "Chest",
      name: "Ornate Chest",
      doMoveThatToThis: function ({asset1}) {
        switch (asset1.name) {
          case "Golden Idol":
            let msg = "The ornate chest accepts the golden idol and belches loudly. ";
            MyGame.overrideOutput(msg);
            break;
          default:
            // do nothing and allow the default result
            break;
        }
        return;
      },
    });
    

Notes

  • See verb reaction hooks for more details.
  • Reaction hooks aren't specific to any particular verb.
  • Verb reactions fire at the end of a turn after the verb's doSuccess phase. Many verbs may call the same reactions. For instance, any verb that moves an asset into the player calls do_move_this_to_that. This makes them more broadly applicable than verb actions and lets you customize the turn's output regardless of what verb is used.
  • Verb action hooks work the same way as reaction hooks, but are specific to their particular verb.
  • Verb phase hooks are a different form of hook that allows authors to override entire verb phases.

jump params

Some verbs may have custom params. When an asset subscribes to such a verb, the verb's params are mirrored in the asset's verb subscription, where they are unique to that asset. To put it another way: while each verb may have a unique set of params, each asset may have its own customized version of those params.

For example, consider this setting of the verb plugIn:

MyGame.dictionary.verbs.plugIn.with_params.max_connections = 1

By default, assets that can be plugged in will take this setting and can only be plugged in to one other asset. Now imagine that an author wants to create a power cord that needs to be plugged in to both a computer and an outlet. The author can achieve that by customizing the cord's subscription to plugIn.

Expand for example
MyGame.createAsset({
  class: "Cable",
  name: "power cord",
  dov: { plugIn: { with_assets: ['computer','outlet'], with_params: { max_connections: 2 }, }, },
})
MyGame.createAsset({
  class: "Computer",
  name: "PC",
  iov: { plugIn: { with_assets: ['power cord'], }, },
})
MyGame.createAsset({
  class: "ElectricalOutlet",
  name: "outlet",
  iov: { plugIn: { with_assets: ['power cord'], }, },
})

In this example, the power cord verb subscription's max_connections setting overrides the verb's max_connections setting, allowing the player to plug the power cord into two assets. The computer and the outlet don't have any custom value set for max_connections; they'll receive the default value, meaning they each can have only one asset plugged into them.

Notes

  • It is possible for authors to modify a verb's params through the use of patchVerb.
  • To learn more about modifying verbs, see Modify Verbs.

Private Constructor:

MyGame.createVerb({ "name": "jump", [...] });

jump is a predefined instance of Verb that gets constructed automatically at runtime. It is defined in the library as a generic object, and then passed to Dictionary#createVerb for construction, validation, and initialization. Because this is predefined, authors should not need to create new instances. For information on modifying predefined Verbs, see Modify Verbs.

Inherited Overrides

Index

Methods:

Properties:

Methods Collapse all  |  Expand all

agree
agree()

Defined in: adventure/dictionary/Verb.js, line 2998

Inherited from: adventurejs.Verb#agree

Return name of the verb taking into consideration third-person singular present tense for subjects using nonhuman / male / female pronouns (he/she/it) or proper name.
canBeIntransitive
canBeIntransitive()

Defined in: adventure/dictionary/Verb.js, line 2734

Inherited from: adventurejs.Verb#canBeIntransitive

Verb can be intransitive if it doesn't require a noun.
do
do()

Defined in: adventure/dictionary/Verb.js, line 1077

Inherited from: adventurejs.Verb#do

Verb.do is a coordinating method that sequences six other submethods in a series. In the case of Verb instances that can act on a collection of Assets in a single turn, Verb.do only fires once, but it loops through the Asset collection and calls each submethod for every Asset in the collection. The sequence is:

do -> The two key submethods are Verb.doTry and Verb.doSuccess. For most Verb instances, these two methods contain the bulk of the logic particular to this Verb. Verb.doTry determines whether a Verb can act on an Asset, and if it can't, prints an error message and an optional debug statement to Display. Verb.doSuccess applies the Verb to the Asset: updates the game state, assembles dynamic output, and prints the results to Display.

A Verb instance doesn't have to use all of these methods. Some specialized Verbs including oops and undo override Verb.do entirely and don't use any submethods.

The other four submethods – Verb.doBeforeTry, Verb.doAfterTry, Verb.doBeforeSuccess, and Verb.doAfterSuccess – exist to provide optional hooks for authors to add custom interactions with individual Assets.

For more information about Verb Actions and Verb Phases, see Verb Actions and Verb Phases.

And so, the first thing Verb.do does is to verify that each method exists on the Verb instance. If the submethod exists, it is called. Each submethod sends a return to Verb.do.

If the Verb is acting on a collection, a false return means that the Asset currently being acted on has responded in a way that blocks further parsing, and brings this turn to a halt. A null return means that the Asset currently being acted on has concluded its own parsing, but not in such a way as to block further parsing, and Verb.do moves on to the next Asset.
doSuccess
doSuccess()

Defined in: adventure/dictionary/Verb.js, line 1804

Inherited from: adventurejs.Verb#doSuccess

doSuccess typically contains all the code needed to apply this Verb to the specified Asset once it has successfully passed through all of our conditional logic. doBeforeSuccess and doAfterSuccess are provided so that authors can apply custom success code on an item-by-item basis, but it is also possible to globally modify doSuccess. For information about modifying verbs, see Modify Verbs.
doTry
doTry()

Defined in: adventure/dictionary/Verb.js, line 1416

Inherited from: adventurejs.Verb#doTry

doTry typically contains all the specific logic needed to determine if this Verb can act on the specified Asset. (We already applied some general logic supplied by NounMustBe before arriving here.) For information about modifying verbs, see Modify Verbs.
enqueueCollection
enqueueCollection()

Defined in: adventure/dictionary/Verb.js, line 2397

Inherited from: adventurejs.Verb#enqueueCollection

enqueueCollection takes a collection of Assets and enqueues them to game.parser for sequential handling.
getState
getState()

Defined in: adventure/dictionary/Verb.js, line 2752

Inherited from: adventurejs.Verb#getState

Get this verb's state or unstate.
handleActions
handleActions()

Defined in: adventure/dictionary/Verb.js, line 1431

Inherited from: adventurejs.Verb#handleActions

handleActions attempts to call any verb actions that match the current assets and sentence structure.
handleFailure
handleFailure()

Defined in: adventure/dictionary/Verb.js, line 2441

Inherited from: adventurejs.Verb#handleFailure

handleFailure prints either a given fail message or a generic fail msg if one is specified.
handleSuccess
handleSuccess()

Defined in: adventure/dictionary/Verb.js, line 2540

Inherited from: adventurejs.Verb#handleSuccess

handleSuccess prints the provided success message or a generic one that has been defined by author. It also checks direct and indirect objects for custom verb subscription on_success results and tryDestroy results.
hasState
hasState()

Defined in: adventure/dictionary/Verb.js, line 2743

Inherited from: adventurejs.Verb#hasState

Does this verb have state or unstate?
hasStructure
hasStructure() → {boolean}

Defined in: adventure/dictionary/Verb.js, line 2770

Inherited from: adventurejs.Verb#hasStructure

Test if this verb supports the given sentence structure.

Returns:

boolean
hasVerbSubscriptionConnection
hasVerbSubscriptionConnection()

Defined in: adventure/dictionary/Verb.js, line 2901

Inherited from: adventurejs.Verb#hasVerbSubscriptionConnection

Test whether two assets are connected by this verb, for example a rope tied to a tree, or a computer plugged into a socket.
initialize
initialize()

Defined in: adventure/dictionary/Verb.js, line 2368

Inherited from: adventurejs.Verb#initialize

Todos: How does patchVerb handle initialization?

If Verb is a direction, initialize adds it to game.dictionary.direction_lookup.
set
set(props) → {adventurejs.Verb}

Defined in: adventure/dictionary/Verb.js, line 2429

Inherited from: adventurejs.Verb#set

Parameters:

  • props Object
    A generic object containing properties to copy to the DisplayObject instance.
Provides a chainable shortcut method for setting a number of properties on the instance.

Returns:

adventurejs.Verb Returns the instance the method is called on (useful for chaining calls.)
setState
setState()

Defined in: adventure/dictionary/Verb.js, line 2761

Inherited from: adventurejs.Verb#setState

Apply this verb's state or unstate to an asset.
setVerbConnection
setVerbConnection()

Defined in: adventure/dictionary/Verb.js, line 2780

Inherited from: adventurejs.Verb#setVerbConnection

Connect two assets that share a connection when acted upon by this verb. For example, in the case of 'plug computer into socket', each asset has the other asset's ID saved like this:

computer.is.connected_by.plugIn.to_iov = ['socket']
socket.is.connected_by.plugIn.to_dov = ['computer']
tryDestroyAfterUsing
tryDestroyAfterUsing(object_of, asset) → {Object}

Defined in: adventure/asset/tryDestroyAfterUsing.js, line 6

Inherited from: adventurejs.Verb#tryDestroyAfterUsing

Parameters:

  • object_of String
  • asset Object
tryDestroyAfterUsing is the underlying function for tryDestroyDirectObjectAfterUsing and tryDestroyIndirectObjectAfterUsing.

Returns:

Object
tryDestroyDirectObjectAfterUsing
tryDestroyDirectObjectAfterUsing(asset) → {Boolean|string}

Defined in: adventure/asset/tryDestroyDirectObjectAfterUsing.js, line 6

Inherited from: adventurejs.Verb#tryDestroyDirectObjectAfterUsing

Parameters:

  • asset Object
tryDestroyDirectObjectAfterUsing checks to see if the specified asset can only be used directly once with this verb by checking for asset.dov[this.name].then_destroy. This is intended to provide a hook for authors to easily destroy an object after a single use, such as a key that only works once and then breaks or disappears.

Returns:

Boolean | string
tryDestroyIndirectObjectAfterUsing
tryDestroyIndirectObjectAfterUsing(asset) → {Boolean|string}

Defined in: adventure/asset/tryDestroyIndirectObjectAfterUsing.js, line 6

Inherited from: adventurejs.Verb#tryDestroyIndirectObjectAfterUsing

Parameters:

  • asset Object
tryDestroyIndirectObjectAfterUsing checks to see if the specified asset can only be used indirectly once with this verb by checking for asset.iov[this.name].then_destroy. This is intended to provide a hook for authors to easily destroy an object after a single use, such as a key that only works once and then breaks or disappears.

Returns:

Boolean | string
tryPhaseHook
tryPhaseHook(phase) → {*}

Defined in: adventure/dictionary/Verb.js, line 1821

Inherited from: adventurejs.Verb#tryPhaseHook

Parameters:

  • phase *

Returns:

*
tryToInferIndirectObject
tryToInferIndirectObject(options) → {Object}

Defined in: adventure/dictionary/Verb.js, line 1897

Inherited from: adventurejs.Verb#tryToInferIndirectObject

Parameters:

  • options Object
    An object of options.
    Properties
    • direct_object Object
    • handle_input Boolean
      If true, updates the global input object per standard specs used by most (but not all) of the verb instances that call this method.
    • context Object
      The subject, usually player, could be an NPC.
    • infer_first_use Boolean
      Optional param to set whether inference should work on first use.
tryToInferIndirectObject is called by some verbs when they receive a direct object with no indirect object, to test whether an indirect object can be inferred. The classic example is "unlock door" where the key must be inferred. In order to be inferred, indirect object must be in player inventory. If player hasn't already interacted with direct object and game.settings.objects_must_be_used_before_inferring is true, tryToInferIndirectObject will fail regardless of other circumstances. The function only returns one indirect preposition: with. As in, "unlock door with key" or "feed pony with hay".

Returns:

Object
tryToPutThisInThatAspect
tryToPutThisInThatAspect(direct_object, preposition, indirect_object) → {Object}

Defined in: adventure/dictionary/Verb.js, line 2114

Inherited from: adventurejs.Verb#tryToPutThisInThatAspect

Parameters:

  • direct_object Object
  • preposition String
  • indirect_object Object
tryToPutThisInThatAspect checks to see if one asset can be placed within the specified aspect of another specified asset. For example, "put sword in stone" and "push stone into depression" would both be tested with this function.

Returns:

Object
unsetVerbConnection
unsetVerbConnection()

Defined in: adventure/dictionary/Verb.js, line 2841

Inherited from: adventurejs.Verb#unsetVerbConnection

Disconnect two assets that share a connection when acted upon by this verb. For example, in the case of 'plug computer into socket', each asset has the other asset's ID saved like this:

computer.is.connected_by.plugIn.to_iov = ['socket']
socket.is.connected_by.plugIn.to_dov = ['computer']
validate
validate()

Properties  | 

.accepts_adverbs
(static) accepts_adverbs
accepts_adverbs
accepts_adverbs :Array

Defined in: adventure/dictionary/Verb.js, line 432

Inherited from: adventurejs.Verb#accepts_adverbs

Default value: []

accepts_direction
accepts_direction :String

Defined in: adventure/dictionary/Phrase.js, line 26

Inherited from: adventurejs.Verb#accepts_direction

Currently unused.
accepts_number
accepts_number :String

Defined in: adventure/dictionary/Phrase.js, line 40

Inherited from: adventurejs.Verb#accepts_number

Currently unused.
accepts_string
accepts_string :String

Defined in: adventure/dictionary/Phrase.js, line 19

Inherited from: adventurejs.Verb#accepts_string

Currently unused.
accepts_structures
accepts_structures :Array

Defined in: adventure/dictionary/Verb.js, line 426

Inherited from: adventurejs.Verb#accepts_structures

Default value: []

adjectives
adjectives :String

Defined in: adventure/dictionary/Verb.js, line 299

Overrides from: adventurejs.Verb#adjectives

Verb.adjective is for direction verbs so that, for example, 'south' can be described as 'southerly'.
allow_iov_on_iov
allow_iov_on_iov :Array

Defined in: adventure/dictionary/Verb.js, line 500

Inherited from: adventurejs.Verb#allow_iov_on_iov

Default value: false

Most verbs use a pattern of dov operates on iov. Think, "unlock door with key". Some verbs use two objects that would appear to follow the same pattern until you consider an implied direct object. In "write on paper with pen" and "type on paper with typewriter", there is actually an implied direct object - the thing to be written or typed - which makes paper and pen/typewriter both indirect. If true, allow_iov_on_iov allows for some additional checking when querying whether a verb is allowed to operate on a particular pair of assets.
article
article :Boolean

Defined in: adventure/dictionary/Verb.js, line 388

Inherited from: adventurejs.Verb#article

Default value: false

Set whether a direction can be referred to with an article, as in "there is a door to the north" vs "there is a door to starboard". This is a bit of mixed purpose because this property doesn't apply to the verb, but is stored in direction_lookup for reference with directions.
can_span
can_span :String

Defined in: adventure/dictionary/Verb.js, line 236

Inherited from: adventurejs.Verb#can_span

Locomotion verbs (ones that move the player) may result in player moving from object A to object B. When that occurs, output may vary depending on whether player would logically climb down off object A before climbing on object B, vs directly spanning the gap from object A to object B.
default_direction
default_direction :String

Defined in: adventure/dictionary/Verb.js, line 163

Inherited from: adventurejs.Verb#default_direction

Default value: ""

Some locomotion verbs supplied without a preposition may use a default direction, for instance climb + up.
dictionary
dictionary :Object

Defined in: adventure/dictionary/Verb.js, line 143

Inherited from: adventurejs.Verb#dictionary

Default value: {}

A shortcut to the main Game Dictionary.
direction_preposition
direction_preposition :Boolean

Defined in: adventure/dictionary/Verb.js, line 400

Inherited from: adventurejs.Verb#direction_preposition

Default value: ""

When player travels, this string may be prepended before the verb name, such as "you walk to the north"
doVerb
doVerb :Getter

Defined in: adventure/dictionary/Verb.js, line 596

Inherited from: adventurejs.Verb#doVerb

Returns "do[Verb]This" for consistency with doVerbAction()
doVerbFromThis
doVerbFromThis :Getter

Defined in: adventure/dictionary/Verb.js, line 612

Inherited from: adventurejs.Verb#doVerbFromThis

Returns "do[Verb]FromThis" for consistency with doVerbAction()
doVerbThatFromThis
doVerbThatFromThis :Getter

Defined in: adventure/dictionary/Verb.js, line 652

Inherited from: adventurejs.Verb#doVerbThatFromThis

Returns "do[Verb]ThatFromThis" for consistency with doVerbAction()
doVerbThatWithThis
doVerbThatWithThis :Getter

Defined in: adventure/dictionary/Verb.js, line 636

Inherited from: adventurejs.Verb#doVerbThatWithThis

Returns "do[Verb]ThatWithThis" for consistency with doVerbAction()
doVerbThis
doVerbThis :Getter

Defined in: adventure/dictionary/Verb.js, line 604

Inherited from: adventurejs.Verb#doVerbThis

Returns "do[Verb]This" for consistency with doVerbAction()
doVerbThisFromThat
doVerbThisFromThat :Getter

Defined in: adventure/dictionary/Verb.js, line 644

Inherited from: adventurejs.Verb#doVerbThisFromThat

Returns "do[Verb]ThisFromThat" for consistency with doVerbAction()
doVerbThisWithThat
doVerbThisWithThat :Getter

Defined in: adventure/dictionary/Verb.js, line 628

Inherited from: adventurejs.Verb#doVerbThisWithThat

Returns "do[Verb]ThisWithThat" for consistency with doVerbAction()
doVerbWithThis
doVerbWithThis :Getter

Defined in: adventure/dictionary/Verb.js, line 620

Inherited from: adventurejs.Verb#doVerbWithThis

Returns "do[Verb]WithThis" for consistency with doVerbAction()
enqueue_collections
enqueue_collections :Array

Defined in: adventure/dictionary/Verb.js, line 487

Inherited from: adventurejs.Verb#enqueue_collections

Default value: false

enqueue_collections if true allows a verb to unbundle the members of a collection in order to queue up separate actions for each. For example, "gems" is a collection that refers to three unique assets; "diamond", "emerald" and "ruby". If take.enqueue_collections is true, "take gems" will act individually on the diamond, the emerald and the ruby. Only applies to direct object.
extends
extends :String

Defined in: adventure/dictionary/Verb.js, line 171

Inherited from: adventurejs.Verb#extends

Default value: ""

Extension verbs may perform some contextual logic before forwarding to another verb for the bulk of logic, such as "crawl" -> "go".
game
game :Object

Defined in: adventure/dictionary/Verb.js, line 136

Inherited from: adventurejs.Verb#game

Default value: {}

A reference back to the main Game object.
gerund
gerund :String

Defined in: adventure/dictionary/Verb.js, line 200

Inherited from: adventurejs.Verb#gerund

The gerund of the verb. May be used in output strings.
in_can_mean_on
in_can_mean_on :Boolean

Defined in: adventure/dictionary/Verb.js, line 355

Inherited from: adventurejs.Verb#in_can_mean_on

Default value: false

Some types of objects can accept 'in' for 'on' interchangeably, such as 'sit in chair' / 'sit on chair', or 'lie in bed' / 'lie on bed'.
input_substitutions
input_substitutions :Object

Defined in: adventure/dictionary/Verb.js, line 438

Inherited from: adventurejs.Verb#input_substitutions

Default value: {}

To simplify identifying verbs in input, specifically with regards to adverbs & prepositions, we can provide a list of synonyms for the verb. The parser will look for these synonyms in the input and replace them with the verb name. Then, the verb can handle the adverb/preposition as it sees fit.
is_compass_direction
is_compass_direction :Boolean

Defined in: adventure/dictionary/Verb.js, line 371

Inherited from: adventurejs.Verb#is_compass_direction

Default value: false

Set whether direction verb is a compass direction, meaning, it can be found on a compass rose.
is_direction
is_direction :Boolean

Defined in: adventure/dictionary/Verb.js, line 364

Inherited from: adventurejs.Verb#is_direction

Default value: false

Set whether verb is a direction verb.
is_relative_direction
is_relative_direction :Boolean

Defined in: adventure/dictionary/Verb.js, line 379

Inherited from: adventurejs.Verb#is_relative_direction

Default value: false

Set whether direction verb is a relative direction such as those used on ships: port, starboard, etc. Also applies to left, right, forward, back, etc.
let_verb_handle_disambiguation
let_verb_handle_disambiguation :Boolean

Defined in: adventure/dictionary/Verb.js, line 335

Inherited from: adventurejs.Verb#let_verb_handle_disambiguation

Default value: false

Setting this to true allows you to write your own disambiguation script. Warning: going off road! Recommended for experienced Javascript users.
let_verb_handle_remaining_input
let_verb_handle_remaining_input :Boolean

Defined in: adventure/dictionary/Verb.js, line 344

Inherited from: adventurejs.Verb#let_verb_handle_remaining_input

Default value: false

When input is parsed, parse the verb and then pass the remainder of the input to the verb as a string, for the verb to act on. Chief example is: "oops xxx" where we don't want to parse xxx, we just want to let oops use it as a substitute for last turn's unknown input.
name
name :String

Defined in: adventure/dictionary/Verb.js, line 179

Inherited from: adventurejs.Verb#name

Default value: ""

String provided in Verb definition file (aka preverb).
Name
Name :Getter

Defined in: adventure/dictionary/Verb.js, line 520

Inherited from: adventurejs.Verb#Name

Default value: []

Return uppercase name of the verb.
override_verb_failure_msg
override_verb_failure_msg :String

Defined in: adventure/dictionary/Verb.js, line 450

Inherited from: adventurejs.Verb#override_verb_failure_msg

Default value: undefined

Provides a simple method for an author to override all failure messages for a verb with one generic string.
override_verb_success_msg
override_verb_success_msg :String

Defined in: adventure/dictionary/Verb.js, line 459

Inherited from: adventurejs.Verb#override_verb_success_msg

Default value: undefined

Provides a simple method for an author to override success messages for a verb with one generic string.
past_tense
past_tense :String

Defined in: adventure/dictionary/Verb.js, line 194

Inherited from: adventurejs.Verb#past_tense

The past tense of the verb. May be used in output strings.
phrase1
phrase1 :Object

Defined in: adventure/dictionary/Verb.js, line 408

Inherited from: adventurejs.Verb#phrase1

Default value: {}

phrase2
phrase2 :Object

Defined in: adventure/dictionary/Verb.js, line 414

Inherited from: adventurejs.Verb#phrase2

Default value: {}

phrase3
phrase3 :Object

Defined in: adventure/dictionary/Verb.js, line 420

Inherited from: adventurejs.Verb#phrase3

Default value: {}

posture
posture :String

Defined in: adventure/dictionary/Verb.js, line 206

Overrides from: adventurejs.Verb#posture

Set a preferred posture that results when this verb acts on player. asset.aspect.aspect.nest.posture takes precedence unless this.override_aspect_posture = true.
prettyname
prettyname :String

Defined in: adventure/dictionary/Verb.js, line 186

Inherited from: adventurejs.Verb#prettyname

String provided in verb definition file. The prettyname is used for printing, and can include spaces, ie ask prints as "ask about".
related requires_number
requires_number :String

Defined in: adventure/dictionary/Phrase.js, line 47

Inherited from: adventurejs.Verb#requires_number

Currently unused.
requires_string
requires_string :String

Defined in: adventure/dictionary/Phrase.js, line 33

Inherited from: adventurejs.Verb#requires_string

Currently unused.
state
state :String

Defined in: adventure/dictionary/Verb.js, line 247

Inherited from: adventurejs.Verb#state

state is an optional property for verbs that apply state to assets, such as close and lock. For example, "close door" will set door.is.closed to true. When used, state will contain the state to be set true on an asset. In the case of close, its state would be "closed".
state_strings
state_strings :String

Defined in: adventure/dictionary/Verb.js, line 267

Inherited from: adventurejs.Verb#state_strings

state_strings is an optional property for verbs that is used to provide string substitutions for authors using the string substitution form of {sink drain [is] plugged [or] unplugged}. Because "unplugged" isn't a proper verb state, we'll use this as a reverse lookup to test whether the asset, sink_drain in this case, is subscribed to the relevant verb and has the specified state. state_strings only apply to direct objects.
subject_must_be
subject_must_be :Object

Defined in: adventure/dictionary/Verb.js, line 315

Inherited from: adventurejs.Verb#subject_must_be

Default value: {}

subject_must_be sets conditions that the subject must meet in order for the Verb to act upon it. player: true is set by default. In order to allow player to instruct an NPC to perform a verb such as "Floyd, go east", that verb must be set player: false.
synonyms
synonyms :Getter/Setter

Defined in: adventure/dictionary/Verb.js, line 660

Inherited from: adventurejs.Verb#synonyms

Default value: []

synonyms provide alternate words for verbs, such as "get" for "take".
tryVerbFromThis
tryVerbFromThis :Getter

Defined in: adventure/dictionary/Verb.js, line 556

Inherited from: adventurejs.Verb#tryVerbFromThis

Returns "try[Verb]FromThis" for consistency with doVerbAction()
tryVerbThatFromThis
tryVerbThatFromThis :Getter

Defined in: adventure/dictionary/Verb.js, line 588

Inherited from: adventurejs.Verb#tryVerbThatFromThis

Returns "try[Verb]ThatFromThis" for consistency with doVerbAction()
tryVerbThatWithThis
tryVerbThatWithThis :Getter

Defined in: adventure/dictionary/Verb.js, line 572

Inherited from: adventurejs.Verb#tryVerbThatWithThis

Returns "try[Verb]ThatWithThis" for consistency with doVerbAction()
tryVerbThis
tryVerbThis :Getter

Defined in: adventure/dictionary/Verb.js, line 540

Inherited from: adventurejs.Verb#tryVerbThis

Returns "try[Verb]This" for consistency with doVerbAction()
tryVerbThisFromThat
tryVerbThisFromThat :Getter

Defined in: adventure/dictionary/Verb.js, line 580

Inherited from: adventurejs.Verb#tryVerbThisFromThat

Returns "try[Verb]ThisFromThat" for consistency with doVerbAction()
tryVerbThisWithThat
tryVerbThisWithThat :Getter

Defined in: adventure/dictionary/Verb.js, line 564

Inherited from: adventurejs.Verb#tryVerbThisWithThat

Returns "try[Verb]ThisWithThat" for consistency with doVerbAction()
tryVerbWithThis
tryVerbWithThis :Getter

Defined in: adventure/dictionary/Verb.js, line 548

Inherited from: adventurejs.Verb#tryVerbWithThis

Returns "try[Verb]WithThis" for consistency with doVerbAction()
type
type :String

Defined in: adventure/dictionary/Verb.js, line 151

Inherited from: adventurejs.Verb#type

Default value: ""

May be used to help narrow verb selections in ambiguous situations.
unstate
unstate :String

Defined in: adventure/dictionary/Verb.js, line 257

Inherited from: adventurejs.Verb#unstate

unstate is an optional property for verbs that unset state from assets, such as open and unlock. For example, "open door" will set door.is.closed to false. When used, unstate will contain the state to be set false on an asset. In the case of open, its unstate would be "closed".
verb_noun_prep
verb_noun_prep :Array

Defined in: adventure/dictionary/Verb.js, line 726

Inherited from: adventurejs.Verb#verb_noun_prep

Default value: []

For verb/noun pairs with a trailing preposition, or more likely a direction, such as "push bed north". When player input is parsed, they'll be concatenated, eg to "pushnorth bed".
verb_noun_prep_noun
verb_noun_prep_noun :Array

Defined in: adventure/dictionary/Verb.js, line 890

Inherited from: adventurejs.Verb#verb_noun_prep_noun

Default value: []

For verb/preposition pairs separated by another word, usually a noun, such as "lock door with key" or "take sword from stone". When player input is parsed, they'll be concatenated, eg to "lockwith door key" or "takefrom sword stone".

Though verb_prep_noun and verb_noun_prep_noun look similar, the reason they are separate fields is because we have to use different regex patterns to find each type in user input.
verb_noun_prep_noun_prep_noun
verb_noun_prep_noun_prep_noun :Array

Defined in: adventure/dictionary/Verb.js, line 979

Inherited from: adventurejs.Verb#verb_noun_prep_noun_prep_noun

Default value: []

For a verb phrase with three nouns and two prepositions. For example, in the phrase "tie boat to pier with rope", we're looking for "tie" and "to" and "with", and we would parse the phrase as "tietowith boat pier rope"
verb_noun_prep_prep_noun
verb_noun_prep_prep_noun :Array

Defined in: adventure/dictionary/Verb.js, line 937

Inherited from: adventurejs.Verb#verb_noun_prep_prep_noun

Default value: []

For a verb phrase with two nouns and two prepositions. For example, in the phrase "take skateboard from under bed", we're looking for "take" and "from" and "under", and we would parse the phrase as "takefromunder skateboard bed"
verb_prep_noun
verb_prep_noun :Array

Defined in: adventure/dictionary/Verb.js, line 767

Inherited from: adventurejs.Verb#verb_prep_noun

Default value: []

For verb/preposition pairs separated by a space, such as "go to" or "look at". When player input is parsed, they'll be concatenated, eg "go to" to "goTo".
verb_prep_noun_prep_noun
verb_prep_noun_prep_noun :Array

Defined in: adventure/dictionary/Verb.js, line 684

Inherited from: adventurejs.Verb#verb_prep_noun_prep_noun

Default value: []

For phrases like "jump from branch to vine" or "look at sun with glasses", where we have a verb + preposition followed by a noun and then another preposition
verb_prep_noun_prep_noun_prep_noun
verb_prep_noun_prep_noun_prep_noun :Array

Defined in: adventure/dictionary/Verb.js, line 1025

Inherited from: adventurejs.Verb#verb_prep_noun_prep_noun_prep_noun

Default value: []

For a verb phrase with three nouns and three prepositions. For example, in the phrase "swing from branch to tree on vine", we're looking for "swing from with on".
verb_prep_prep_noun
verb_prep_prep_noun :Array

Defined in: adventure/dictionary/Verb.js, line 808

Inherited from: adventurejs.Verb#verb_prep_prep_noun

Default value: []

For compound preps separated by spaces, verb/prep/prep, such as "get out of"
verb_prep_prep_prep_noun
verb_prep_prep_prep_noun :Array

Defined in: adventure/dictionary/Verb.js, line 849

Inherited from: adventurejs.Verb#verb_prep_prep_prep_noun

Default value: []

For three part compound preps, verb/prep/prep/prep, such as "get out from behind"