Adventure.js Docs Downloads
Score: 0 Moves: 0

Class: Collection

Extends: adventurejs.Scenery

Defined in: adventure/assets/tangibles/scenery/Collection.js, line 6

How to: UseCollections

Public Constructor:

MyGame.createAsset({ "class":"Collection", "name":"foo", [...] })

Collection provides a way to perform some verbs on a specific group of related objects. In the example below, a Desk has three Drawers. Each drawer can be open or closed. A player might input something like examine drawers. Normally, that would lead to a disambiguation prompt such as Which did $(we) mean? 1. The top drawer, 2. the middle drawer, or 3. the bottom drawer? Here, we've made a collection for the three drawers lets players refer to the three drawers as one object.

MyGame.createAsset({
  class: "Desk",
  name: "desk",
  place: { in: "Office" },
  descriptions: { 
    look: function()
    { 
      return "It's a heavy wooden desk. It has three drawers 
      stacked vertically. The top drawer is $( top drawer is open or closed ), 
      the middle drawer is $( middle drawer is open or closed ), 
      and the bottom drawer is $( bottom drawer is open or closed )." 
    }, 
  },
  adjectives: "wooden, heavy",
});
MyGame.createAsset({
  class: "Drawer",
  name: "top drawer",
  synonyms: "top desk drawer, top drawer lock, lock",
  descriptions: { look: "The top drawer is $( top drawer is open or closed ). ", },
  adjectives: "desk",
  place: { attached: "desk" },
  is: { 
    direct_object_of_verb: { 
      unlock: { with_assets: ['tiny brass key'], },
    }, 
  },
  is: { locked: true, listed_in_parent: false },
});
MyGame.createAsset({
  class: "Drawer",
  name: "middle drawer",
  synonyms: "middle desk drawer",
  descriptions: { look: "The middle drawer is $( middle drawer is open or closed ). ", },
  adjectives: "desk",
  place: { attached: "desk" },
  is: { listed_in_parent: false },
});
MyGame.createAsset({
  class: "Drawer",
  name: "bottom drawer",
  synonyms: "bottom desk drawer",
  descriptions: { look: "The bottom drawer is $( bottom drawer is open or closed ). ", },
  adjectives: "desk",
  place: { attached: "desk" },
  is: { listed_in_parent: false },
});
MyGame.createAsset({
  class: "Collection",
  name: "desk drawers",
  place: { attached: "desk" },
  collection: "top drawer, middle drawer, bottom drawer",
  synonyms: [ "drawers", "three drawers" ],
  is: { listed_in_parent: false },
  descriptions: {
    look: function()
    {
      var openCount = [];
      var closedCount = [];
      var complicatedMsg = "The desk has three drawers stacked vertically. ";   * 
      MyGame.$("top drawer").is.closed ?
        closedCount.push( "top drawer" ) : openCount.push( "top drawer" );
      MyGame.$("middle drawer").is.closed ?
        closedCount.push( "middle drawer" ) : openCount.push( "middle drawer" );
      MyGame.$("bottom drawer").is.closed ?
        closedCount.push( "bottom drawer" ) : openCount.push( "bottom drawer" );
  
      if( 0 === openCount.length ) 
      {
        complicatedMsg += "All three are closed.";
      } 
      else if( 0 === closedCount.length ) 
      {
        complicatedMsg += "All three are open.";
      } 
      else if ( 2 == openCount.length ) 
      {
        complicatedMsg += "The "
        + openCount[ 0 ]
        + " and the "
        + openCount[ 1 ]
        + " are open. The "
        + closedCount[ 0 ]
        + " is closed. ";
      } 
      else if ( 2 == closedCount.length ) 
      {
        complicatedMsg += "The "
        + closedCount[ 0 ]
        + " and the "
        + closedCount[ 1 ]
        + " are closed. The "
        + openCount[ 0 ]
        + " is open. ";
      }
      return complicatedMsg
    },
  },
});

In the "desk drawers" Collection, take special note of these lines:

name: "desk drawers",
  synonyms: [ "drawers", "three drawers" ],
  collection: "top drawer, middle drawer, bottom drawer",
  place: { attached: "desk" },
  is: { listed_in_parent: false },
  • collection is set to a list of the items that the Collection represents. This is important, because some Verb actions will be forwarded to the items in the list. In this example, open drawers will try to open each drawer in turn as if the player had input open top drawer then open middle drawer then open bottom drawer.
  • name and synonyms have been set to plural words that players are likely to use.
  • thing_this_is_attached is set to desk, the same as the drawers, and is.listed_in_parent is set to desk so that the Collection doesn't show up in the Room description.
  • Private Constructor:

    var foo = new adventurejs.Collection(game_name, name)

    Though all in-game glasses use a standard constructor method under the hood, it's unlikely that you'd need to call it directly. To create an instance of the Collection class, it must be defined in a game file as a generic object. That object will be used at runtime to construct a new game class instance, which will be validated and initialized before adding it to the Game. See above for the public constructor, or see Game#createAsset to learn more.

    Parameters:

    • game_name String
      The name of the top level game object.
    • name String
      A name for the object, to be serialized and used as ID.
    Inherited Overrides
    IndexMethodsProperties

    Index

    Methods:

    Properties:

    Methods Collapse all  |  Expand all

    $is(property, asset)

    Defined in: adventure/assets/tangible/$is.js, line 6

    Inherited from: adventurejs.Tangible#$is

    Todos: Leaving open the possibility for other params.

    Parameters:

    • property String
    • asset Object
    $is() is a convenience method for authors that provides an easy way to test for various conditions.
    • assetA.$is("in", assetB)
      accepts any preposition, asking, is this asset in that aspect of that asset?
    • assetA.$is("nested in", assetB)
      nested in, specific to character classes, asking, is this asset nested in that asset?
    • assetA.$is("closed")
      asking, is this asset closed?
    • assetA.$is("locked")
      asking, is this asset locked?
    • assetA.$is("plugged")
      asking, is this asset plugged?
    • assetA.$is("sealed")
      asking, is this asset sealed?
    • assetA.$is("held", assetB)
      asking, is this asset held by that asset, as in a bannister held by player?
    • assetA.$is("holding", assetB)
      asking, is this asset holding that asset, as in player holding a rope?
    • assetA.$is("worn")
      asking, is this asset being worn?
    • assetA.$is("zipped")
      asking, is this asset zipped?
    • assetA.$is("open")
      asking, is this asset open?
    • assetA.$is("unlocked")
      asking, is this asset unlocked?
    • assetA.$is("unplugged")
      asking, is this asset unplugged?
    • assetA.$is("unsealed")
      asking, is this asset unsealed?
    $moveTo(aspect, asset)

    Defined in: adventure/assets/tangible/$moveTo.js, line 6

    Inherited from: adventurejs.Tangible#$moveTo

    Parameters:

    • aspect String
    • asset Object
    $moveTo is an author shortcut that is similar to moveTo but which bypasses onMoveThatToThis, avoiding the consequences of any verb event hooks.
    addAssetAt() → {Array}

    Defined in: adventure/assets/tangible/addAssetAt.js, line 6

    Inherited from: adventurejs.Tangible#addAssetAt

    Add specified asset id to the contents of specified aspect on this asset. Returns contents if aspect exists, or null.

    Returns:

    Array
    addWordsToLookup(allTheWords, typeOfWord)

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

    Inherited from: adventurejs.Asset#addWordsToLookup

    Parameters:

    • allTheWords Array
    • typeOfWord String
    addWordsToLookup() takes words associated with this asset and adds them to the global lookup table.
    aliases()

    Defined in: adventure/Asset.js, line 951

    Inherited from: adventurejs.Asset#aliases

    aliases() is a collection of method names that are meant for authors to use. Since they don't exist on all classes, we set up these aliases so that, if authors call them on classes they're not applicable to, they will politely return null instead of throwing a "not a function" error.
    areAnscestorsClosed() → {Boolean}

    Defined in: adventure/assets/tangible/areAnscestorsClosed.js, line 6

    Inherited from: adventurejs.Tangible#areAnscestorsClosed

    Checks to see if this asset's containing parent(s) is closed. Takes into account nesting doll situations and looks all the way up the chain. Useful for determining whether a player can interact with a nested object.

    Returns:

    Boolean
    areAnscestorsKnown() → {Boolean}

    Defined in: adventure/assets/tangible/areAnscestorsKnown.js, line 6

    Inherited from: adventurejs.Tangible#areAnscestorsKnown

    Checks to see if this asset and its containing parent(s) are known to player. Takes into account nesting doll situations and looks all the way up the chain. Useful for determining whether a player can "see" a nested object.

    Returns:

    Boolean
    areAnscestorsOpen() → {Boolean}

    Defined in: adventure/assets/tangible/areAnscestorsOpen.js, line 6

    Inherited from: adventurejs.Tangible#areAnscestorsOpen

    Checks to see if this asset's containing parent(s) is open. Takes into account nesting doll situations and looks all the way up the chain. Useful for determining whether a player can interact with a nested object.

    Returns:

    Boolean
    areAnscestorsUnknown(nestlevel) → {Boolean}

    Defined in: adventure/assets/tangible/areAnscestorsUnknown.js, line 6

    Inherited from: adventurejs.Tangible#areAnscestorsUnknown

    Parameters:

    • nestlevel int
    Checks to see if this asset or its containing parent(s) are unknown to player. Takes into account nesting doll situations and looks all the way up the chain. Useful for determining whether a player can "see" a nested object.

    Returns:

    Boolean
    canBePlacedInAspectOfAsset(aspect, asset) → {Boolean}

    Defined in: adventure/assets/tangible/canBePlacedInAspectOfAsset.js, line 6

    Inherited from: adventurejs.Tangible#canBePlacedInAspectOfAsset

    Parameters:

    • aspect String
    • asset Object
    Check whether this asset can be placed within the specified aspect of the specified asset. This takes into account the with_assets and with_classes properties.

    Returns:

    Boolean
    canContainAnySubstance() → {Boolean}

    Defined in: adventure/assets/tangible/canContainAnySubstance.js, line 6

    Inherited from: adventurejs.Tangible#canContainAnySubstance

    Determine whether asset can contain any substance.

    Returns:

    Boolean
    canContainAssetAt(object) → {Boolean}

    Defined in: adventure/assets/tangible/canContainAssetAt.js, line 6

    Inherited from: adventurejs.Tangible#canContainAssetAt

    Parameters:

    • object Object
    Check whether this asset can be attached to specified other asset.

    Returns:

    Boolean
    canPlayerNest(aspect) → {Boolean}

    Defined in: adventure/assets/tangible/canPlayerNest.js, line 9

    Inherited from: adventurejs.Tangible#canPlayerNest

    Parameters:

    • aspect String
      A Tangible Aspect ID.
    Ask if player can nest in an aspect of this asset.

    Returns:

    Boolean
    canPlayerReachThatFromThis(object) → {Boolean}

    Defined in: adventure/assets/tangible/canPlayerReachThatFromThis.js, line 6

    Inherited from: adventurejs.Tangible#canPlayerReachThatFromThis

    Parameters:

    • object Object
    Check whether that asset can be reached by player when nested in this asset.

    Returns:

    Boolean
    canSetVerbState(verb) → {Boolean}

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

    Inherited from: adventurejs.Asset#canSetVerbState

    Parameters:

    • verb String
    canSetVerbState is a method to check whether the specified verb can set state on this asset. Assumes that asset.is.direct_object_of_verb[verb].enabled is true

    Returns:

    Boolean
    destroy()

    Defined in: adventure/assets/Tangible.js, line 2151

    Inherited from: adventurejs.Tangible#destroy

    Todos: What else needs to happen on destroy?

    Remove this asset from the world before calling superclass.destroy.
    didDoVerbs(verbs) → {Boolean}

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

    Inherited from: adventurejs.Asset#didDoVerbs

    Parameters:

    • verbs Array
    didDoVerbs check whether any of the specified verbs has ever been applied to the asset as a direct object. This is a convenience method that relies on asset.DOVdidDo()

    Returns:

    Boolean
    didIoVerbs(verbs) → {Boolean}

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

    Inherited from: adventurejs.Asset#didIoVerbs

    Parameters:

    • verbs Array
    didIoVerbs check whether any of the specified verbs has ever been applied to the asset as an indirect object. This is a convenience method that relies on asset.IOVdidDo()

    Returns:

    Boolean
    doesContainAnyAsset() → {Boolean}

    Defined in: adventure/assets/tangible/doesContainAnyAsset.js, line 6

    Inherited from: adventurejs.Tangible#doesContainAnyAsset

    Check whether this asset contains any assets.

    Returns:

    Boolean
    doesContainAnyAssetAt(aspect) → {Boolean}

    Defined in: adventure/assets/tangible/doesContainAnyAssetAt.js, line 6

    Inherited from: adventurejs.Tangible#doesContainAnyAssetAt

    Parameters:

    • aspect String
    Check whether this asset contains any assets.

    Returns:

    Boolean
    doesContainAnySubstance() → {Boolean}

    Defined in: adventure/assets/tangible/doesContainAnySubstance.js, line 6

    Inherited from: adventurejs.Tangible#doesContainAnySubstance

    Check whether this asset contains any substance.

    Returns:

    Boolean
    doesContainAnySubstanceAt(aspect) → {Boolean}

    Defined in: adventure/assets/tangible/doesContainAnySubstanceAt.js, line 6

    Inherited from: adventurejs.Tangible#doesContainAnySubstanceAt

    Parameters:

    • aspect String
    Check whether this asset contains any substance at specified aspect.

    Returns:

    Boolean
    doesContainAsset(id) → {String}

    Defined in: adventure/assets/tangible/doesContainAsset.js, line 6

    Inherited from: adventurejs.Tangible#doesContainAsset

    Parameters:

    • id String
    Check whether this asset contains the specified asset.

    Returns:

    String
    doesContainAssetAt(id, aspect) → {Boolean}

    Defined in: adventure/assets/tangible/doesContainAssetAt.js, line 6

    Inherited from: adventurejs.Tangible#doesContainAssetAt

    Parameters:

    • id String
    • aspect String
    Check whether this asset contains the specified asset at the specified aspect.

    Returns:

    Boolean
    doesContainSubstance(id) → {String}

    Defined in: adventure/assets/tangible/doesContainSubstance.js, line 6

    Inherited from: adventurejs.Tangible#doesContainSubstance

    Parameters:

    • id String
    Check whether this asset contains the specified substance.

    Returns:

    String
    doesContainSubstanceAt(id, aspect) → {Boolean}

    Defined in: adventure/assets/tangible/doesContainSubstanceAt.js, line 6

    Inherited from: adventurejs.Tangible#doesContainSubstanceAt

    Parameters:

    • id String
    • aspect String
    Check whether this asset contains the specified substance.

    Returns:

    Boolean
    DOVallowOnce(verb) → {Boolean}

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

    Inherited from: adventurejs.Asset#DOVallowOnce

    Parameters:

    • verb String
    DOVallowOnce is a method to check whether this asset is subscribed to allow the specified verb to act on it as a direct object only once.

    Returns:

    Boolean
    DOVallowWithAnything(verb) → {Boolean}

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

    Inherited from: adventurejs.Asset#DOVallowWithAnything

    Parameters:

    • verb String
    DOVallowWithAnything is a method to check whether this asset is subscribed to act as a direct object with the specified verb without any direct object.

    Returns:

    Boolean
    DOVallowWithAsset(verb, asset) → {Boolean}

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

    Inherited from: adventurejs.Asset#DOVallowWithAsset

    Parameters:

    • verb String
    • asset Object
    DOVallowWithAsset is a method to check whether this asset is subscribed to act as a direct object with the specified verb and indirect object.

    Returns:

    Boolean
    DOVallowWithNothing(verb) → {Boolean}

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

    Inherited from: adventurejs.Asset#DOVallowWithNothing

    Parameters:

    • verb String
    DOVallowWithNothing is a method to check whether this asset is subscribed to act as a direct object with the specified verb without any indirect object. For example, "plug in computer" where when an outlet is implied but not defined.

    Returns:

    Boolean
    DOVdidDo(verb) → {Boolean}

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

    Inherited from: adventurejs.Asset#DOVdidDo

    Parameters:

    • verb String
    DOVdidDo is a method to check whether this asset was already used as a direct objecb by the specified verb.

    _didDo is an alias meant for authors.

    Returns:

    Boolean
    DOVdidDoCount(verb) → {Int}

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

    Inherited from: adventurejs.Asset#DOVdidDoCount

    Parameters:

    • verb String
    DOVdidDoCount is a method to get a count of times this asset was used as a direct object by the specified verb.

    _doCount is an alias meant for authors.

    Returns:

    Int
    DOVdidTry(verb) → {Boolean}

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

    Inherited from: adventurejs.Asset#DOVdidTry

    Parameters:

    • verb String
    DOVdidTry is a method to check whether it was attempted to use this asset as a direct object by the specified verb.

    _didTry is an alias meant for authors.

    Returns:

    Boolean
    DOVdidTryCount(verb) → {Boolean}

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

    Inherited from: adventurejs.Asset#DOVdidTryCount

    Parameters:

    • verb String
    DOVdidTryCount is a method to get a count of times it was tried to use this asset as a direct object by the specified verb.

    _tryCount is an alias meant for authors.

    Returns:

    Boolean
    DOVgetConnectionCount(verb) → {Int}

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

    Inherited from: adventurejs.Asset#DOVgetConnectionCount

    Parameters:

    • verb String
      The name of a verb.
    Return this.is.direct_object_of_verb[verb].with_params.connections.length

    Returns:

    Int
    DOVgetConnections(verb) → {Array}

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

    Inherited from: adventurejs.Asset#DOVgetConnections

    Parameters:

    • verb String
      The name of a verb.
    Return this.is.direct_object_of_verb[verb].with_params.connections

    Returns:

    Array
    DOVgetMaxConnections(verb) → {Int}

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

    Inherited from: adventurejs.Asset#DOVgetMaxConnections

    Parameters:

    • verb String
      The name of a verb.
    Return this.is.direct_object_of_verb[verb].with_params.max_connections

    Returns:

    Int
    DOVhasIndirectObjects(verb) → {Boolean}

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

    Inherited from: adventurejs.Asset#DOVhasIndirectObjects

    Parameters:

    • verb String
    DOVhasIndirectObjects is a method to check whether this asset has any particular indirect objects specified by the author for use with the specified verb.

    Returns:

    Boolean
    DOVhasMaxConnections(verb) → {Boolean}

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

    Inherited from: adventurejs.Asset#DOVhasMaxConnections

    Parameters:

    • verb String
      The name of a verb.
    Get whether the DOV has maximum connections.

    Returns:

    Boolean
    DOVincrementDoCount(verb)

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

    Inherited from: adventurejs.Asset#DOVincrementDoCount

    Parameters:

    • verb String
    DOVincrementDoCount is a method to increment the number of times the specified verb has acted on this asset as a direct object.
    DOVincrementTryCount(verb)

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

    Inherited from: adventurejs.Asset#DOVincrementTryCount

    Parameters:

    • verb String
    DOVincrementTryCount is a method to increment the number of times the specified verb has been tried on this asset as a direct object.
    DOVisConnectedToAnything(verb) → {Boolean}

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

    Inherited from: adventurejs.Asset#DOVisConnectedToAnything

    Parameters:

    • verb String
      The name of a verb.
    Check whether this asset is currently connected to anything directly by a verb such as plugIn or tie. For example, if this asset is a computer plugged into an outlet, this method would return true.

    Returns:

    Boolean
    DOVisConnectedToAsset(verb, asset) → {Boolean}

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

    Inherited from: adventurejs.Asset#DOVisConnectedToAsset

    Parameters:

    • verb String
      The name of the verb to test.
    • asset Object | String
      A game asset or asset id to test.
    Check whether this asset is currently connected as a direct object to the specified indirect object by the specified verb. For example, in the case of a computer plugged into an outlet, the computer would be the direct object, and calling this method on it would return true.

    Returns:

    Boolean
    DOVisConnectedToNothing(verb) → {Boolean}

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

    Inherited from: adventurejs.Asset#DOVisConnectedToNothing

    Parameters:

    • verb String
      The name of a verb.
    Check whether this asset is currently connected as an indirect object to nothing by the specified verb. For example, in the case of a computer that can be plugged in, an author might prefer not to create a specific outlet into which to plug the computer. For that case we allow 'plug in computer', and store a null value to asset.is.direct_object_of_verb.plugIn.with_params.connections to represent the computer's plugged in state.

    Returns:

    Boolean
    DOVsetConnection(verb, asset)

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

    Inherited from: adventurejs.Asset#DOVsetConnection

    Parameters:

    • verb String
    • asset Object
    Set asset's direct verb param connection to specified indirect object.
    DOVsetWithAsset(verb, asset) → {Boolean}

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

    Inherited from: adventurejs.Asset#DOVsetWithAsset

    Parameters:

    • verb String
    • asset Object
    DOVsetWithAsset is used to specify another asset that can be used as an indirect object with this asset as direct object. For example, if this asset is a locking chest, chest.DOVsetWithAsset('unlock', 'gold key') would add the gold key as an indirect object of the chest.

    Returns:

    Boolean
    DOVsetWithClass(verb, clas) → {Boolean}

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

    Inherited from: adventurejs.Asset#DOVsetWithClass

    Parameters:

    • verb String
    • clas String
    DOVsetWithClass is a method to add an indirect object class to asset.is.direct_object_of_verb[verb].with_classes.

    Returns:

    Boolean
    DOVunsetConnection(verb, asset)

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

    Inherited from: adventurejs.Asset#DOVunsetConnection

    Parameters:

    • verb String
    • asset Object
    Unset asset's direct verb param connection to specified indirect object.
    event_hooks()

    Defined in: adventure/assets/Tangible.js, line 1498

    Inherited from: adventurejs.Tangible#event_hooks

    Todos: move all this!

    Allow authors to insert custom logic on a per-asset basis, when specified assets react to being manipulated by verbs. To use, create a key/value pair for each asset you wish to insert logic for, where the key is the name of the other asset and the value is an anonymous function, as in this example:
    MyGame.createAsset({
      class: "Bicycle",// THIS asset to be nested to
      name: "bicycle",
      event_hooks: {
        onNestThatToThis: {
          "Mighty Hero": function(params){ // THAT asset to be nested 
            MyGame.prependToNextPrint("You wobble a bit getting on the bike. ");
            MyGame.appendToNextPrint("Success! ");
          }
        },
      },
    });
    
    This example only adds some text to the output for the turn, but overrides can be used to add any kind of logic. Here's are some of the reactions that can be overriden:
  • onMoveThatToThis - when that asset is moved to this asset
  • onRemoveThisFromThat - when this asset is removed from that asset
  • onRemoveThatFromThis - when that asset is removed from this asset
  • onMoveThisToThat - when this asset is moved to that asset
  • onNestThatToThis - when that character is nested to this asset
  • onNestThisToThat - when this character is nested to that asset
  • onUnnestThatFromThis - when that character is unnested from this asset
  • onUnnestThisFromThat - when this character is unnested from that asset
  • onSubtractSubstanceFromThis - when a substance is subtracted from this asset
  • onAddSubstanceToThis - when a substance is added to this asset
  • onDestroyThis - when this asset is removed from the game
  • onChangeMoisture - when this asset is moistened
  • onChangeTemperature - when this asset is subjected to a change in temperature
  • onChangeGravity - when this asset is subjected to a change in gravity
  • onTieThisToThat - when this asset is tied to that asset
  • onTieThatToThis - when that asset is tied to this asset
  • onUntieThisFromThat - when this asset is untied from that asset
  • onUntieThatFromThis - when that asset is untied from this asset
  • onTurnThis - when this asset is turned
  • onTurnThisWithThat - when this asset is turned with that asset
  • onTurnThatWithThis - when that asset is turned with this asset
  • onLetGoThis - when player lets go of this asset
  • onHoldThis - when player holds this asset
  • onDrinkThis - when this asset is drunk
  • onDrinkFromThis - when this asset is drunk from
  • get(property, qualifier)

    Defined in: adventure/assets/tangible/$get.js, line 6

    Inherited from: adventurejs.Tangible#get

    Parameters:

    • property String
    • qualifier String
    Utility function that provides an easy way for authors to test for various conditions.
    • all - list things anywhere in this
    • behind - list things behind this
    • in - list things in this
    • on - list things on this
    • under - list things under this
    • attached - list things attached to this
    getAllContents() → {Array}

    Defined in: adventure/assets/tangible/getAllContents.js, line 6

    Inherited from: adventurejs.Tangible#getAllContents

    Returns an array of all content in any location

    Returns:

    Array
    getAllNestedContents() → {Array}

    Defined in: adventure/assets/tangible/getAllNestedContents.js, line 6

    Inherited from: adventurejs.Tangible#getAllNestedContents

    Get list of other assets nested within this one.

    Returns:

    Array
    getAncestorId() → {String}

    Defined in: adventure/assets/tangible/getAncestorId.js, line 6

    Inherited from: adventurejs.Tangible#getAncestorId

    Get the ID of this asset's topmost parent, excluding Room.

    Returns:

    String
    getAnySubstanceThisContains() → {String}

    Defined in: adventure/assets/tangible/getAnySubstanceThisContains.js, line 6

    Inherited from: adventurejs.Tangible#getAnySubstanceThisContains

    Get the substance, if any, contained in this asset.

    Returns:

    String
    getAspectAt(aspect) → {Object|Null}

    Defined in: adventure/assets/tangible/getAspectAt.js, line 6

    Inherited from: adventurejs.Tangible#getAspectAt

    Parameters:

    • aspect string
      The aspect to get.
    Get aspect at specified preposition.

    Returns:

    Object | Null
    getAspectWithVessel() → {String}

    Defined in: adventure/assets/tangible/getAspectWithVessel.js, line 6

    Inherited from: adventurejs.Tangible#getAspectWithVessel

    Get this asset's substance location. This is somewhat ambiguous because in theory an asset can have multiple substance locations but in practice we clearly prefer 'in'.

    Returns:

    String
    getClosedAnscestors() → {Array}

    Defined in: adventure/assets/tangible/getClosedAnscestors.js, line 6

    Inherited from: adventurejs.Tangible#getClosedAnscestors

    Get a list of this asset's containing parent(s) that are closed. Takes into account nesting doll situations and looks all the way up the chain. Useful for determining whether a player can interact with a nested object.

    Returns:

    Array
    getContentsAt() → {Array}

    Defined in: adventure/assets/tangible/getContentsAt.js, line 6

    Inherited from: adventurejs.Tangible#getContentsAt

    Returns an array of all content in the specified aspect.

    Returns:

    Array
    getCountOfListableContentsAt(where) → {int}

    Defined in: adventure/assets/tangible/getCountOfListableContentsAt.js, line 6

    Inherited from: adventurejs.Tangible#getCountOfListableContentsAt

    Parameters:

    • where String
    Get a count of assets within this asset that are listable in this asset's description, for example when player examines this.

    Returns:

    int
    getDescription(description) → {String}

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

    Inherited from: adventurejs.Asset#getDescription

    Parameters:

    • description String
    Get a description, such as "look in book", where "in" has been defined as a key at asset.descriptions.in. "look" is always the default description.

    Returns:

    String
    getIndirectDescription(indirect_aspect, indirect_asset, direct_aspect) → {String}

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

    Inherited from: adventurejs.Asset#getIndirectDescription

    Parameters:

    • indirect_aspect String
    • indirect_asset Object
    • direct_aspect String
    Get indirect description, such as "look at this through magnifying glass", where "through magnifying glass" is a key at asset.descriptions["through magnifying glass"].description "look" is always the default direct object description.

    Returns:

    String
    getInheritance() → {Array}

    Defined in: adventure/Atom.js, line 238

    Inherited from: adventurejs.Atom#getInheritance

    getInheritance is a utility method to get an asset's inheritance chain. Returns a list of class names from high to low.

    Returns:

    Array
    getListableContents() → {Array}

    Defined in: adventure/assets/tangible/getListableContents.js, line 6

    Inherited from: adventurejs.Tangible#getListableContents

    Get an array of assets within this asset that are listable in this asset's description, for example when player examines this.

    Returns:

    Array
    getNestedInstancesOfClass(instanceClass) → {Array}

    Defined in: adventure/assets/tangible/getNestedInstancesOfClass.js, line 6

    Inherited from: adventurejs.Tangible#getNestedInstancesOfClass

    Parameters:

    • instanceClass String
    Find instances of specified class within this asset, for example find all coins within a purse. Returns an array of asset IDs.

    Returns:

    Array
    getOpenOrClosed() → {Array}

    Defined in: adventure/assets/tangible/getOpenOrClosed.js, line 6

    Inherited from: adventurejs.Tangible#getOpenOrClosed

    Print a string representing open / closed state of this asset.

    Returns:

    Array
    getPlaceAspect() → {Object|null}

    Defined in: adventure/assets/tangible/getPlaceAspect.js, line 6

    Inherited from: adventurejs.Tangible#getPlaceAspect

    Returns the aspect object of this asset's parent asset or null.

    Returns:

    Object | null
    getPlaceAspectId() → {String}

    Defined in: adventure/assets/tangible/getPlacePreposition.js, line 6

    Inherited from: adventurejs.Tangible#getPlaceAspectId

    Returns the aspect id of this asset's parent asset, or a blank string.

    Returns:

    String
    getPlaceAsset() → {Object|Boolean}

    Defined in: adventure/assets/tangible/getPlaceAsset.js, line 6

    Inherited from: adventurejs.Tangible#getPlaceAsset

    Get the object of this asset's parent asset.

    Returns:

    Object | Boolean
    getPlaceAssetId() → {String}

    Defined in: adventure/assets/tangible/getPlaceAssetId.js, line 6

    Inherited from: adventurejs.Tangible#getPlaceAssetId

    Returns the ID of asset's parent or a blank string.

    Returns:

    String
    getPrintableListOfContents(params) → {String}

    Defined in: adventure/assets/tangible/getPrintableListOfContents.js, line 6

    Inherited from: adventurejs.Tangible#getPrintableListOfContents

    Parameters:

    • params Object
    Get a printable list of assets within all Aspects of this asset, for example to append to asset description when player inputs "examine this". Returns a string.

    Returns:

    String
    getProperty(prop) → {Boolean}

    Defined in: adventure/Atom.js, line 184

    Inherited from: adventurejs.Atom#getProperty

    Parameters:

    • prop String
      Name of the property to test for. Can include dot notation.
    A method to get a deep property without throwing an error. Allows for getting deep properties, ie "foo.bar.baz". Returns false if property doesn't exist, so beware of if(false === foo.bar.baz) comparisons.

    Returns:

    Boolean
    getRoomAsset() → {String}

    Defined in: adventure/assets/tangible/getRoomAsset.js, line 6

    Inherited from: adventurejs.Tangible#getRoomAsset

    Get the asset of the room this asset is in.

    Returns:

    String
    getRoomId() → {String}

    Defined in: adventure/assets/tangible/getRoomId.js, line 6

    Inherited from: adventurejs.Tangible#getRoomId

    Get the ID of the room this asset is in.

    Returns:

    String
    getRopesThatBlockTravel() → {Array}

    Defined in: adventure/assets/tangible/getRopesThatBlockTravel.js, line 6

    Inherited from: adventurejs.Tangible#getRopesThatBlockTravel

    Check if player is holding a rope, or tied by a rope, that is tied at the other end, preventing player from leaving room. Return a list of assets that meet this qualification.

    Returns:

    Array
    getSubstanceAt() → {String}

    Defined in: adventure/assets/tangible/getSubstanceAt.js, line 6

    Inherited from: adventurejs.Tangible#getSubstanceAt

    Get the substance, if any, contained in this asset.

    Returns:

    String
    getThingThisIsTiedToPlayerBy() → {Object}

    Defined in: adventure/assets/tangible/getThingThisIsTiedToPlayerBy.js, line 6

    Inherited from: adventurejs.Tangible#getThingThisIsTiedToPlayerBy

    Assuming this asset is tied to the player asset by means of a third thing, get that third thing. Returns an asset object.

    Returns:

    Object
    getTiedThingsThatDragOnTravel() → {Array}

    Defined in: adventure/assets/tangible/getTiedThingsThatDragOnTravel.js, line 6

    Inherited from: adventurejs.Tangible#getTiedThingsThatDragOnTravel

    Check if player is holding a rope, or tied by a rope, that is tied at the other end to an asset that can travel with player. Return a list of assets that meet this qualification.

    Returns:

    Array
    getVesselAt(aspect) → {Object|Null}

    Defined in: adventure/assets/tangible/getVesselAt.js, line 6

    Inherited from: adventurejs.Tangible#getVesselAt

    Parameters:

    • aspect string
      The aspect to check.
    Get substance container at specified preposition.

    Returns:

    Object | Null
    getYBottom() → {Float}

    Defined in: adventure/assets/tangible/getYBottom.js, line 6

    Inherited from: adventurejs.Tangible#getYBottom

    Get this asset's global bottom y based on its y and height, which may be negative.

    Returns:

    Float
    getYRange() → {Object}

    Defined in: adventure/assets/tangible/getYRange.js, line 6

    Inherited from: adventurejs.Tangible#getYRange

    Get this asset's bottom y and top y based on its y and height, which may be negative.

    Returns:

    Object
    getYTop() → {Float}

    Defined in: adventure/assets/tangible/getYTop.js, line 6

    Inherited from: adventurejs.Tangible#getYTop

    Get this asset's global top y based on its y and height.

    Returns:

    Float
    has()

    Defined in: adventure/asset/_has.js, line 7

    Inherited from: adventurejs.Asset#has

    has is an alias to asset.isIn() that reverses the direct and indirect objects, to test whether that asset is in this asset.
    if( MyGame.$('crown').$has('jewel') ){ // do stuff }
    
    hasAspectAt(aspect) → {Boolean}

    Defined in: adventure/assets/tangible/hasAspectAt.js, line 6

    Inherited from: adventurejs.Tangible#hasAspectAt

    Parameters:

    • aspect String
    Determine whether asset has an aspect at specified preposition.

    Returns:

    Boolean
    hasClass(prop) → {Boolean}

    Defined in: adventure/Atom.js, line 216

    Inherited from: adventurejs.Atom#hasClass

    Parameters:

    • prop String
      Name of the classe to test for.
    A method to test whether the Atom is an instance of a given class.

    Returns:

    Boolean
    hasContentsAtAspect(aspect) &r