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

Instance of: adventurejs.Verb

Defined in: adventure/dictionary/verbs/_directions/left.js, line 5

More info: VerbSubscriptions VerbAnatomy VerbProcess ModifyVerbs WriteVerbs

Runtime node: game.dictionary.verbs.left

> left
You turn to the left. Cannons. You turn to the right. More cannons.
You turn back to front. Still more cannons. You're beginning to
understand why they call it "the valley of Death".

Direction verb: go left. Because left is a relative direction, it's assumed that there probably won't be a left exit, though it does support one. The verb logic looks for a port exit first, which would be left in nautical terms, then looks for a left exit, then defaults to telling the player they turn in place. To learn about Exits, see Create an Exit.

left 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 left, though they include many features which are common to most verbs.

  • Sentence Structures help filter player input by defining what sentence structures left can handle.
  • Verb Phrases describe the direct and indirect objects that left can handle.
  • Verb Subscriptions enable left 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 left's default logic and inject custom code.
  • Verb Reactions are Verb Actions that occur as secondary effects of successfully applying left.
  • Verb Params contain properties that are distinct to left. Not all verbs have params.
  • Verb Methods lists the methods that left inherits from the Verb class.
  • Verb Properties lists the properties that left inherits from the Verb class.

left sequencing

left sentence structures

accepts_structures: [
  "verb"
]

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. This helps to filter player input. 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.

  • 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.

left phrases

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

  • 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.

left verb phases

Verb phases are parts of verb subscriptions that allow authors to override how left is applied to any specific asset. 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 left is applied to an asset, it attempts to run a sequence of methods. All verbs have a do() method, and for most verbs, do() acts as a sequencer that moves the verb through six distinct sub-methods, or phases: doBeforeTry, doTry, doAfterTry, doBeforeSuccess, doSuccess and doAfterSuccess. Each phase serves a specific purpose.

  • doTry handles all the default conditional logic to determine whether a verb can be applied to an asset: ie, is the asset present, visible, reachable, etc?
  • doSuccess handles state changes and printing messages back to the player.
  • The other four phases, doBeforeTry, doAfterTry, doBeforeSuccess and doAfterSuccess have no default logic. Instead they offer hooks for the author to inject custom code anywhere in the life cycle of the verb action.

See below for examples of how to use verb phases for left.

do

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

    doTry

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

    doSuccess

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

For example, consider the verb "take" as applied to this singing sword. Imagine that an author wants the 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( params )
      {
        let msg = "The sword begins to vibrate as your hand curls around its haft. ";
        MyGame.print( msg );
      },
      doAfterSuccess: function( params )
      {
        let msg = "The sword bursts into song in your hand. ";
        MyGame.print( msg );
      },
    },
  },
});

Note that verb subscriptions are set distinctly for direct objects and indirect objects. All of the prior examples show verb phases applied to direct object verb subscriptions. Verb phases can also be applied to indirect object subscriptions. For example, perhaps our swinging sword had to be removed from a stone. We might want to hook into the stone's indirect object verb subscription for "remove".

MyGame.createAsset({
  class: "Thing",
  name: "stone",
  iov: {
    remove: 
    {
      doBeforeTry: function( params )
      {
        let msg = "Will the stone judge you worthy enough to remove the sword? "
        MyGame.print( msg );
      },
      doAfterSuccess: function( params )
      {
        let msg = "With the sword removed, the stone bursts into rubble! ";
        MyGame.print( msg );
        this.destroy();
      },      
    },
  },
});
  • To learn more, see Verb Phases.
  • Verb Phases are related to but distinct from Verb Actions, which offers a more surgical method to hook into the doTry and doSuccess phases, on a per object basis.

left verb actions

These verb actions are available for the verb left. Expand any item to see a code example.

tryLeft

If left is called without a direct object as in "left", the verb.handleActions() method looks for a verb action on the player.

MyGame.createAsset({
  class: "Player",
  name: "My Hero",
  tryLeft: function (params) {
    let msg = 'Called verb action my_hero.tryLeft()';
    MyGame.print(msg);
  },
});
doLeft

If left is called without a direct object as in "left", the verb.handleActions() method looks for a verb action on the player.

MyGame.createAsset({
  class: "Player",
  name: "My Hero",
  doLeft: function (params) {
    let msg = 'Called verb action my_hero.doLeft()';
    MyGame.print(msg);
  },
});

WHY SO MANY???

Verb actions provide hooks that allow authors to inject custom code in response to specific combinations of verb/preposition/noun. There are a lot of them and clearly some are redundant; in its defense, it's a deliberate effort to offer a menu of precise injection points for authors' custom code. To use a verb action, just use the verb action name as a method on any asset. Below is a generic example of how to code a verb action.

Expand for example

In this example, the pistol asset has two verb actions.

  • pistol.doShootThis() will be called when a player inputs "shoot pistol".
  • pistol.doShootThatWithThis.television() will be called when a player inputs "shoot television with pistol".
MyGame.createAsset({
  class: "Player",
  name: "Elvis",  
});
MyGame.createAsset({
  class: "Weapon",
  name: "pistol",
  doShootThis: {
    let msg = `You fire the pistol! BANG! `;
      MyGame.print(msg);
  },
  doShootThatWithThis:{
    "television": function {
      let msg = `You fire the pistol at the television! BANG! 
        The television explodes with sparks and a screech of static. `;
      MyGame.print(msg);
    },
  },
});
MyGame.createAsset({
  class: "Electronics",
  name: "television",
});

Verb actions are called by the verb.handleActions() method, which looks for those nested functions and calls whatever function it finds. Each verb has a unique set of actions, which mirror the sentence structures the verb can handle. For instance, the verb lock handles "verb noun" and "verb noun preposition noun", and so it handles tryLockThis and doLockThis and tryLockThisWithThat and doLockThisWithThat.

The difference between try actions and do actions is one of timing. try actions fire immediately before a verb's doTry phase, which provides an opportunity to supersede a verb's default conditional logic before it tests whether the verb can be applied to the assets. do actions fire immediately before a verb's doSuccess phase, which provides an opportunity to supersede or append the verb's state changes and output to the player.

It's common for sentence structures to be mutated during a verb's doTry phase, as doTry may reorder a player's input to make it conform with the verb's logic. This means that the try and do actions may differ within the same turn. You can check the browser's Javascript console to see which actions are being called.

  • See Verb Actions to learn more.
  • In addition to verb actions, there are verb reactions, which are a set of non-verb-specific hooks that fire as side effects of a verb's doSuccess phase. See Verb Reactions for a complete list of them.
  • Verb actions and reactions are related to but distinct from Verb Phases, which allow authors to broadly override entire phases of a verb.

left verb reactions

doRemoveThisFromThat
Example
doRemoveThatFromThis
Example
doMoveThisToThat
Example
doMoveThatToThis
Example

Verb reactions provide hooks that allow authors to inject custom code into side effects caused by successful verb operations. Consider the verb drop. Inputting "drop lantern" will result in two events – removing the lantern from the player and moving it to the room – which causes these four verb reactions:

• lantern.doRemoveThisFromThat(player)
• player.doRemoveThatFromThis(lantern)
• lantern.doMoveThisToThat(room)
• room.doMoveThatToThis(lantern)

There are four reactions because each asset in the interaction is checked for custom code pertaining to the other. This may seem redundant, but it's done in a deliberate effort to provide flexibility to authors. If you prefer to attach custom code to the lantern, you can. If you prefer to attach custom code to the player, you can. You're welcome to organize your code in whichever way serves you best.

Expand for example

In this example, imagine that an author would like the game to print a custom message whenever Elvis enters or leaves the building, regardless of what verb is used. Authors can hook into any of the doRemoveThisFromThat, doRemoveThatFromThis, doMoveThisToThat, or doMoveThatToThis verb reactions. Below is a generic example of how to code a verb reaction.

MyGame.createAsset({
  class: "Player",
  name: "Elvis",
}),
MyGame.createAsset({
  class: "Room",
  name: "The Building",
  doMoveThatToThis: 
  {
    "Elvis": function() 
    {
      MyGame.print("Elvis has entered The Building! ");
    }
  },
  doRemoveThatFromThis: 
  {
    "Elvis": function() 
    {
      MyGame.print("Elvis has left The Building! ");
    }
  },
}),
  • Verb reactions aren't specific to any particular verb; they may be called by many verbs. See Verb Reactions for a complete list of them.
  • Verb reactions work the same way as Verb Actions. The only differences are that verb reactions are non-specific and only fire at the end of a verb's doSuccess phase.
  • Verb actions and reactions are related to but distinct from Verb Phases, which allow authors to broadly override entire phases of a verb.

left 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: { left: { 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: { left: { 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 left's verb phases.
    Expand for example
    MyGame.createAsset({
      class: "Thing",
      name: "universal widget",
      dov: { 
        left: { 
          doBeforeTry: function (e) {
            console.log("left.doBeforeTry");
          },
        } 
      },
    });
    
  • doAfterTry Verb phases provide methods to override default verb behaviors. See the verb phases section on this page to learn more about left's verb phases.
    Expand for example
    MyGame.createAsset({
      class: "Thing",
      name: "universal widget",
      dov: { 
        left: { 
          doAfterTry: function (e) {
            console.log("left.doAfterTry");
          },
        } 
      },
    });
    
  • doBeforeSuccess Verb phases provide methods to override default verb behaviors. See the verb phases section on this page to learn more about left's verb phases.
    Expand for example
    MyGame.createAsset({
      class: "Thing",
      name: "universal widget",
      dov: { 
        left: { 
          doBeforeSuccess: function (e) {
            console.log("left.doBeforeSuccess");
          },
        } 
      },
    });
    
  • doAfterSuccess Verb phases provide methods to override default verb behaviors. See the verb phases section on this page to learn more about left's verb phases.
    Expand for example
    MyGame.createAsset({
      class: "Thing",
      name: "universal widget",
      dov: { 
        left: { 
          doAfterSuccess: function (e) {
            console.log("left.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: { left: { 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: { left: { on_success: "You left 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: { left: { on_first_success: "You left 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: { left: { on_failure: "You failed to left 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: { left: { on_first_failure: "You failed to left 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: { left: { 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: { left: { 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: { left: { 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: { left: { 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 left's parameters.
    Expand for example
    MyGame.createAsset({
      class: "Thing",
      name: "universal widget",
      dov: { left: { with_params: { left_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: { left: { with_prepositions: [ "through", "over" ] } },
    });
    

  • 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.

left 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.

  • 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": "left", [...] });

left 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

canBeIntransitive()

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

Inherited from: adventurejs.Verb#canBeIntransitive

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

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

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 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 isn't required to use all of these methods. Some Verbs may bypass Verb.doTry because no special conditions are required to apply the Verb. Some specialized Verbs such as 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()

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

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()

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

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()

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

Inherited from: adventurejs.Verb#enqueueCollection

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

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

Inherited from: adventurejs.Verb#getState

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

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

Inherited from: adventurejs.Verb#handleActions

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

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

Inherited from: adventurejs.Verb#handleFailure

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

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

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()

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

Inherited from: adventurejs.Verb#hasState

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

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

Inherited from: adventurejs.Verb#hasStructure

Test if this verb supports the given sentence structure.

Returns:

boolean
hasVerbSubscriptionConnection()

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

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()

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

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(props) → {adventurejs.Verb}

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

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()

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

Inherited from: adventurejs.Verb#setState

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

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

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(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(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(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
tryToInferIndirectObject(direct_object, handle_input) → {Object}

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

Inherited from: adventurejs.Verb#tryToInferIndirectObject

Parameters:

  • 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.
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.infer_objects_after_first_use 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(direct_object, preposition, indirect_object) → {Object}

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

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()

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

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()

Properties  | 

accepts_adverbs :Array

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

Inherited from: adventurejs.Verb#accepts_adverbs

Default value: []

accepts_direction :String

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

Inherited from: adventurejs.Verb#accepts_direction

Currently unused.
accepts_number :String

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

Inherited from: adventurejs.Verb#accepts_number

Currently unused.
accepts_string :String

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

Inherited from: adventurejs.Verb#accepts_string

Currently unused.
accepts_structures :Array

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

Inherited from: adventurejs.Verb#accepts_structures

Default value: []

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'.
article :Boolean

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

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 :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 :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 :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 :Boolean

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

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 :Getter

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

Inherited from: adventurejs.Verb#doVerb

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

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

Inherited from: adventurejs.Verb#doVerbFromThis

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

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

Inherited from: adventurejs.Verb#doVerbThatFromThis

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

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

Inherited from: adventurejs.Verb#doVerbThatWithThis

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

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

Inherited from: adventurejs.Verb#doVerbThis

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

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

Inherited from: adventurejs.Verb#doVerbThisFromThat

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

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

Inherited from: adventurejs.Verb#doVerbThisWithThat

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

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

Inherited from: adventurejs.Verb#doVerbWithThis

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

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

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 :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 :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 :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 :Boolean

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

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 :Object

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

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 :Boolean

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

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 :Boolean

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

Inherited from: adventurejs.Verb#is_direction

Default value: false

Set whether verb is a direction verb.
is_relative_direction :Boolean

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

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 :Boolean

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

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 :Boolean

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

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 :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 :Getter

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

Inherited from: adventurejs.Verb#Name

Default value: []

Return uppercase name of the verb.
override_verb_failure_msg :String

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

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 :String

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

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 :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 :Object

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

Inherited from: adventurejs.Verb#phrase1

Default value: {}

phrase2 :Object

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

Inherited from: adventurejs.Verb#phrase2

Default value: {}

phrase3 :Object

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

Inherited from: adventurejs.Verb#phrase3

Default value: {}

player_must_be :Object

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

Inherited from: adventurejs.Verb#player_must_be

Default value: {}

player_must_be sets conditions that the Player Character must meet in order for the Verb to act.
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.player.posture takes precedence unless this.override_aspect_posture = true.
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".
requires_number :String

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

Inherited from: adventurejs.Verb#requires_number

Currently unused.
requires_string :String

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

Inherited from: adventurejs.Verb#requires_string

Currently unused.
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 :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.
synonyms :Getter/Setter

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

Inherited from: adventurejs.Verb#synonyms

Default value: []

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

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

Inherited from: adventurejs.Verb#tryVerbFromThis

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

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

Inherited from: adventurejs.Verb#tryVerbThatFromThis

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

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

Inherited from: adventurejs.Verb#tryVerbThatWithThis

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

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

Inherited from: adventurejs.Verb#tryVerbThis

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

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

Inherited from: adventurejs.Verb#tryVerbThisFromThat

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

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

Inherited from: adventurejs.Verb#tryVerbThisWithThat

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

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

Inherited from: adventurejs.Verb#tryVerbWithThis

Returns "try[Verb]WithThis" for consistency with callAction()
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 :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 :Array

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

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 :Array

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

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 :Array

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

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 :Array

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

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 :Array

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

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 :Array

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

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 :Array

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

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 :Array

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

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 :Array

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

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"