Class: Substance
Extends: adventurejs.Matter
Defined in: adventure/assets/Substance.js, line 6
How to: UseSubstances
Todos: How is gas volume measured? Is it something other than ml? State conversion Slurries is_edible / is_potable
Public Constructor:
MyGame.createAsset({ "class":"Substance", "name":"foo", [...] })
Substance is a low-level subclass of Asset, and the base class for all Solids, Liquids, Slurries, and Gasses. Substance is one of the pillars of the Game world, along with Tangibles and Intangibles. Substances fall somewhere between Tangibles and Intangibles. Instances of Substances are quasi-global; as with Intangibles, player can refer to Substances regardless of their physical availability, and be understood by the parser. Yet, as with Tangibles, Substances exist in the physical world. Substances have no physical aspect of their own, but are defined by the Vessels that contain them. A glass of water. A pile of dirt. A cylinder of gas. Technically, Substances are infinite. For example, an instance of Water represents all Water, everywhere in the Game, whether it's in a glass or a lake. Substances can be added and divided; Vessels can be emptied and filled.
Example:
Rather than subclassing Substance directly, authors should use Solid, Liquid, Gas, or Slurry.
MyGame.createAsset({
class: "Slurry",
name: "frogurt",
description: "The frogurt is full of vitamins and minerals.
That's good. The frogurt is also cursed. That's bad. ",
});
Private Constructor:
var foo = new adventurejs.Substance(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 Substance 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
Name of top level game instance that is scoped to window. -
name
String
Instance name.
Index
Methods:
- Inherited from Asset $is
- Inherited from Asset addWordsToLookup
- Inherited from Asset aliases
- Inherited from Asset canSetVerbState
- Inherited from Asset destroy
- Inherited from Asset didDoVerbs
- Inherited from Asset didIoVerbs
- Inherited from Asset DOVallowOnce
- Inherited from Asset DOVallowWithAnything
- Inherited from Asset DOVallowWithAsset
- Inherited from Asset DOVallowWithNothing
- Inherited from Asset DOVdidDo
- Inherited from Asset DOVdidDoCount
- Inherited from Asset DOVdidTry
- Inherited from Asset DOVdidTryCount
- Inherited from Asset DOVgetConnectionCount
- Inherited from Asset DOVgetConnections
- Inherited from Asset DOVgetMaxConnections
- Inherited from Asset DOVhasIndirectObjects
- Inherited from Asset DOVhasMaxConnections
- Inherited from Asset DOVincrementDoCount
- Inherited from Asset DOVincrementTryCount
- Inherited from Asset DOVisConnectedToAnything
- Inherited from Asset DOVisConnectedToAsset
- Inherited from Asset DOVisConnectedToNothing
- Inherited from Asset DOVsetConnection
- Inherited from Asset DOVsetWithAsset
- Inherited from Asset DOVsetWithClass
- Inherited from Asset DOVunsetConnection
- Inherited from Asset getDescription
- Inherited from Asset getIndirectDescription
- Inherited from Atom getInheritance
- Inherited from Atom getProperty
- Inherited from Asset has
- Inherited from Atom hasClass
- Inherited from Asset hasDescription
- Inherited from Asset hasEventHook
- Inherited from Asset hasIndirectDescription
- Inherited from Atom hasProperty
- Inherited from Asset incrementDoVerbCount
- Inherited from Asset incrementTryVerbCount
- Inherited from Asset initialize
- Inherited from Asset IOVallowOnce
- Inherited from Asset IOVallowWithAnything
- Inherited from Asset IOVallowWithAsset
- Inherited from Asset IOVallowWithNothing
- Inherited from Asset IOVdidDo
- Inherited from Asset IOVdidDoCount
- Inherited from Asset IOVdidTry
- Inherited from Asset IOVdidTryCount
- Inherited from Asset IOVgetConnectionCount
- Inherited from Asset IOVgetConnections
- Inherited from Asset IOVgetMaxConnections
- Inherited from Asset IOVhasDirectObjects
- Inherited from Asset IOVhasMaxConnections
- Inherited from Asset IOVincrementDoCount
- Inherited from Asset IOVincrementTryCount
- Inherited from Asset IOVisConnectedToAnything
- Inherited from Asset IOVisConnectedToAsset
- Inherited from Asset IOVisConnectedToNothing
- Inherited from Asset IOVsetConnection
- Inherited from Asset IOVsetWithAsset
- Inherited from Asset IOVsetWithClass
- Inherited from Asset IOVunsetConnection
- Inherited from Asset isDOV
- Inherited from Asset isIOV
- Inherited from Asset isVerbState
- Inherited from Asset redirectVerb
- Inherited from Atom set
- Inherited from Asset setDOV
- Inherited from Asset setDOVs
- Inherited from Asset setIOV
- Inherited from Asset setIOVs
- Inherited from Asset setObjectOfVerbs
- Inherited from Asset setVerbSubscription
- Inherited from Asset setVerbSubscriptionsWithAssets
- Inherited from Asset setVerbSubscriptionsWithConnection
- Inherited from Asset toggleVerbState
- Inherited from Asset tryEventHook
- Inherited from Asset undestroy
- Inherited from Asset unredirectVerb
- Inherited from Asset unsetDOV
- Inherited from Asset unsetDOVs
- Inherited from Asset unsetIOV
- Inherited from Asset unsetIOVs
- Inherited from Asset unsetVerbSubscription
- Inherited from Asset validate
Properties:
- Inherited from Asset adjectives
- Inherited from Asset article_name
- Inherited from Asset articlename
- Inherited from Asset Articlename
- Inherited from Atom class
- Inherited from Asset collection
- Inherited from Asset definite_article
- Inherited from Asset definite_name
- Inherited from Asset description
- Inherited from Asset descriptions
- Inherited from Asset did_do_verb
- Inherited from Asset did_do_verb_count
- Inherited from Asset did_try_verb
- Inherited from Asset did_try_verb_count
- Inherited from Asset dont_use_articles
- Inherited from Asset event_hooks
- Inherited from Asset exclude_from_lookup
- Inherited from Atom game
- Inherited from Atom game_name
- Inherited from Atom id
- Inherited from Asset image
- Inherited from Asset indefinite_article
- Inherited from Asset indefinite_name
- Inherited from Asset is
- Inherited from Asset is.abstract
- Inherited from Asset is.collection
- Inherited from Asset is.destroyed
- Inherited from Asset is.direct_object_of_verb
- Inherited from Asset is.extant
- Inherited from Asset is.global
- Inherited from Asset is.initialized
- Inherited from Asset is.known
- Inherited from Asset is.nameless
- Inherited from Asset is.plugged
- Inherited from Asset is.pluggedIn
- Inherited from Asset is.seen
- Inherited from Asset is.singleton
- Inherited from Asset is.used
- Inherited from Asset is.validated
- Inherited from Atom name
- Inherited from Asset name_is_proper
- Inherited from Asset noun
- Inherited from Asset object_of_verb
- Inherited from Asset plural
- Inherited from Asset print_bold
- Inherited from Asset print_italic
- Inherited from Asset pronoun
- Inherited from Asset propername
- Inherited from Asset quirks
- Inherited from Asset singlePluralPairs
- Inherited from Asset split_name_for_world_lookup
- Inherited from Atom UID
- Inherited from Asset use_definite_article_in_lists
- Inherited from Asset verb_hooks
Methods Collapse all |
Defined in: adventure/asset/_is.js, line 7
Inherited from: adventurejs.Asset#$is
asset.is
nested object. It can also test
for more complex circumstances, such as in the case of
Tangibles. For example, if your game has a sword in a stone,
you can test whether the sword is currently in the stone with
MyGame.$("sword").is("in", "stone")
Defined in: adventure/asset/addWordsToLookup.js, line 6
Inherited from: adventurejs.Asset#addWordsToLookup
Parameters:
-
allTheWords
Array -
typeOfWord
String
Defined in: adventure/Asset.js, line 951
Inherited from: adventurejs.Asset#aliases
Defined in: adventure/asset/canSetVerbState.js, line 6
Inherited from: adventurejs.Asset#canSetVerbState
Parameters:
-
verb
String
Returns:
Boolean
Defined in: adventure/asset/destroy.js, line 7
Inherited from: adventurejs.Asset#destroy
Todos: What else needs to happen on destroy?
Defined in: adventure/asset/didDoVerbs.js, line 6
Inherited from: adventurejs.Asset#didDoVerbs
Parameters:
-
verbs
Array
Returns:
Boolean
Defined in: adventure/asset/didIoVerbs.js, line 6
Inherited from: adventurejs.Asset#didIoVerbs
Parameters:
-
verbs
Array
Returns:
Boolean
Defined in: adventure/asset/DOVallowOnce.js, line 6
Inherited from: adventurejs.Asset#DOVallowOnce
Parameters:
-
verb
String
Returns:
Boolean
Defined in: adventure/asset/DOVallowWithAnything.js, line 6
Inherited from: adventurejs.Asset#DOVallowWithAnything
Parameters:
-
verb
String
Returns:
Boolean
Defined in: adventure/asset/DOVallowWithAsset.js, line 6
Inherited from: adventurejs.Asset#DOVallowWithAsset
Parameters:
-
verb
String -
asset
Object
Returns:
Boolean
Defined in: adventure/asset/DOVallowWithNothing.js, line 6
Inherited from: adventurejs.Asset#DOVallowWithNothing
Parameters:
-
verb
String
Returns:
Boolean
Defined in: adventure/asset/DOVdidDo.js, line 6
Inherited from: adventurejs.Asset#DOVdidDo
Parameters:
-
verb
String
_didDo is an alias meant for authors.
Returns:
Boolean
Defined in: adventure/asset/DOVdidDoCount.js, line 6
Inherited from: adventurejs.Asset#DOVdidDoCount
Parameters:
-
verb
String
_doCount is an alias meant for authors.
Returns:
Int
Defined in: adventure/asset/DOVdidTry.js, line 6
Inherited from: adventurejs.Asset#DOVdidTry
Parameters:
-
verb
String
_didTry is an alias meant for authors.
Returns:
Boolean
Defined in: adventure/asset/DOVdidTryCount.js, line 6
Inherited from: adventurejs.Asset#DOVdidTryCount
Parameters:
-
verb
String
_tryCount is an alias meant for authors.
Returns:
Boolean
Defined in: adventure/asset/DOVgetConnectionCount.js, line 6
Inherited from: adventurejs.Asset#DOVgetConnectionCount
Parameters:
-
verb
String
The name of a verb.
Returns:
Int
Defined in: adventure/asset/DOVgetConnections.js, line 6
Inherited from: adventurejs.Asset#DOVgetConnections
Parameters:
-
verb
String
The name of a verb.
Returns:
Array
Defined in: adventure/asset/DOVgetMaxConnections.js, line 6
Inherited from: adventurejs.Asset#DOVgetMaxConnections
Parameters:
-
verb
String
The name of a verb.
Returns:
Int
Defined in: adventure/asset/DOVhasIndirectObjects.js, line 6
Inherited from: adventurejs.Asset#DOVhasIndirectObjects
Parameters:
-
verb
String
Returns:
Boolean
Defined in: adventure/asset/DOVhasMaxConnections.js, line 6
Inherited from: adventurejs.Asset#DOVhasMaxConnections
Parameters:
-
verb
String
The name of a verb.
Returns:
Boolean
Defined in: adventure/asset/DOVincrementDoCount.js, line 6
Inherited from: adventurejs.Asset#DOVincrementDoCount
Parameters:
-
verb
String
Defined in: adventure/asset/DOVincrementTryCount.js, line 6
Inherited from: adventurejs.Asset#DOVincrementTryCount
Parameters:
-
verb
String
Defined in: adventure/asset/DOVisConnectedToAnything.js, line 6
Inherited from: adventurejs.Asset#DOVisConnectedToAnything
Parameters:
-
verb
String
The name of a verb.
plugIn
or tie
. For example, if this asset
is a computer plugged into an outlet, this method would return true.
Returns:
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.
Returns:
Boolean
Defined in: adventure/asset/DOVisConnectedToNothing.js, line 6
Inherited from: adventurejs.Asset#DOVisConnectedToNothing
Parameters:
-
verb
String
The name of a verb.
asset.is.direct_object_of_verb.plugIn.with_params.connections
to represent the computer's plugged in state.
Returns:
Boolean
Defined in: adventure/asset/DOVsetConnection.js, line 6
Inherited from: adventurejs.Asset#DOVsetConnection
Parameters:
-
verb
String -
asset
Object
Defined in: adventure/asset/DOVsetWithAsset.js, line 6
Inherited from: adventurejs.Asset#DOVsetWithAsset
Parameters:
-
verb
String -
asset
Object
Returns:
Boolean
Defined in: adventure/asset/DOVsetWithClass.js, line 6
Inherited from: adventurejs.Asset#DOVsetWithClass
Parameters:
-
verb
String -
clas
String
Returns:
Boolean
Defined in: adventure/asset/DOVunsetConnection.js, line 6
Inherited from: adventurejs.Asset#DOVunsetConnection
Parameters:
-
verb
String -
asset
Object
Defined in: adventure/asset/getDescription.js, line 6
Inherited from: adventurejs.Asset#getDescription
Parameters:
-
description
String
Returns:
String
Defined in: adventure/asset/getIndirectDescription.js, line 6
Inherited from: adventurejs.Asset#getIndirectDescription
Parameters:
-
indirect_aspect
String -
indirect_asset
Object -
direct_aspect
String
Returns:
String
Defined in: adventure/Atom.js, line 238
Inherited from: adventurejs.Atom#getInheritance
Returns:
Array
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.
if(false === foo.bar.baz)
comparisons.
Returns:
Boolean
Defined in: adventure/asset/_has.js, line 7
Inherited from: adventurejs.Asset#has
if( MyGame.$('crown').$has('jewel') ){ // do stuff }
Defined in: adventure/Atom.js, line 216
Inherited from: adventurejs.Atom#hasClass
Parameters:
-
prop
String
Name of the classe to test for.
Returns:
Boolean
Defined in: adventure/asset/hasDescription.js, line 6
Inherited from: adventurejs.Asset#hasDescription
Parameters:
-
description
String
Returns:
String
|
Boolean
Defined in: adventure/asset/hasEventHook.js, line 6
Inherited from: adventurejs.Asset#hasEventHook
Parameters:
-
hook
string -
asset_name
string
We use asset.name here instead of asset.id to make life slightly easier for authors. Asset IDs are formed from asset names, but generally we don't expect authors to be aware of IDs. Hooks will only be defined by authors, so let them use asset.name as their identifier. We do however make an effort to see if an id has been passed instead of a name.
Returns:
Boolean
Defined in: adventure/asset/hasIndirectDescription.js, line 6
Inherited from: adventurejs.Asset#hasIndirectDescription
Parameters:
-
indirect_aspect
String -
indirect_asset
Object -
direct_aspect
String
Returns:
String
|
Boolean
Defined in: adventure/Atom.js, line 148
Inherited from: adventurejs.Atom#hasProperty
Parameters:
-
prop
String
Name of the property to test for. Can include dot notation.
Returns:
Boolean
Defined in: adventure/asset/incrementDoVerbCount.js, line 6
Inherited from: adventurejs.Asset#incrementDoVerbCount
Parameters:
-
verb
String -
index
Int
Defined in: adventure/asset/incrementTryVerbCount.js, line 6
Inherited from: adventurejs.Asset#incrementTryVerbCount
Parameters:
-
verb
String -
index
Int
Defined in: adventure/Asset.js, line 775
Inherited from: adventurejs.Asset#initialize
Because we're not doing natural language processing and everything is indexed, we want to increase the chances that the parser understands player input that is partial or has words jumbled. We add a lookup entry for every combination of an object's adjectives with its noun(s). For example we have a "green colored pencil", and we want the parser to understand "green pencil" or "colored pencil". If there are other colored pencils, we want the parser to understand "colored pencils". If there are colored pencils in three shades of green, we want the parser to understand "green pencils". We store all of these combinations to the lookup.
Defined in: adventure/asset/IOVallowOnce.js, line 6
Inherited from: adventurejs.Asset#IOVallowOnce
Parameters:
-
verb
String
Returns:
Boolean
Defined in: adventure/asset/IOVallowWithAnything.js, line 6
Inherited from: adventurejs.Asset#IOVallowWithAnything
Parameters:
-
verb
String
Returns:
Boolean
Defined in: adventure/asset/IOVallowWithAsset.js, line 6
Inherited from: adventurejs.Asset#IOVallowWithAsset
Parameters:
-
verb
String -
asset
Object
Returns:
Boolean
Defined in: adventure/asset/IOVallowWithNothing.js, line 6
Inherited from: adventurejs.Asset#IOVallowWithNothing
Parameters:
-
verb
String
Returns:
Boolean
Defined in: adventure/asset/IOVdidDo.js, line 6
Inherited from: adventurejs.Asset#IOVdidDo
Parameters:
-
verb
String
_iDidDo is an alias meant for authors.
Returns:
Boolean
Defined in: adventure/asset/IOVdidDoCount.js, line 6
Inherited from: adventurejs.Asset#IOVdidDoCount
Parameters:
-
verb
String
_iDoCount is an alias meant for authors.
Returns:
Int
Defined in: adventure/asset/IOVdidTry.js, line 6
Inherited from: adventurejs.Asset#IOVdidTry
Parameters:
-
verb
String
_iDidTry is an alias meant for authors.
Returns:
Boolean
Defined in: adventure/asset/IOVdidTryCount.js, line 6
Inherited from: adventurejs.Asset#IOVdidTryCount
Parameters:
-
verb
String
_iTryCount is an alias meant for authors.
Returns:
Boolean
Defined in: adventure/asset/IOVgetConnectionCount.js, line 6
Inherited from: adventurejs.Asset#IOVgetConnectionCount
Parameters:
-
verb
String
The name of a verb.
Returns:
Int
Defined in: adventure/asset/IOVgetConnections.js, line 6
Inherited from: adventurejs.Asset#IOVgetConnections
Parameters:
-
verb
String
The name of a verb.
Returns:
Array
Defined in: adventure/asset/IOVgetMaxConnections.js, line 6
Inherited from: adventurejs.Asset#IOVgetMaxConnections
Parameters:
-
verb
String
The name of a verb.
Returns:
Int
Defined in: adventure/asset/IOVhasDirectObjects.js, line 6
Inherited from: adventurejs.Asset#IOVhasDirectObjects
Parameters:
-
verb
String
Returns:
Boolean
Defined in: adventure/asset/IOVhasMaxConnections.js, line 6
Inherited from: adventurejs.Asset#IOVhasMaxConnections
Parameters:
-
verb
String
The name of a verb.
Returns:
Boolean
Defined in: adventure/asset/IOVincrementDoCount.js, line 6
Inherited from: adventurejs.Asset#IOVincrementDoCount
Parameters:
-
verb
String
Defined in: adventure/asset/IOVincrementTryCount.js, line 6
Inherited from: adventurejs.Asset#IOVincrementTryCount
Parameters:
-
verb
String
Defined in: adventure/asset/IOVisConnectedToAnything.js, line 6
Inherited from: adventurejs.Asset#IOVisConnectedToAnything
Parameters:
-
verb
String
The name of a verb.
plugIn
or tie
. For example, if this asset
is an outlet with a computer plugged into it, this method would return true.
Returns:
Boolean
Defined in: adventure/asset/IOVisConnectedToAsset.js, line 6
Inherited from: adventurejs.Asset#IOVisConnectedToAsset
Parameters:
-
verb
String
The name of the verb to test. -
asset
Object | String
A game asset or asset id to test.
Returns:
Boolean
Defined in: adventure/asset/IOVisConnectedToNothing.js, line 6
Inherited from: adventurejs.Asset#IOVisConnectedToNothing
Parameters:
-
verb
String
The name of a verb.
Returns:
Boolean
Defined in: adventure/asset/IOVsetConnection.js, line 6
Inherited from: adventurejs.Asset#IOVsetConnection
Parameters:
-
verb
String -
asset
Object
Defined in: adventure/asset/IOVsetWithAsset.js, line 6
Inherited from: adventurejs.Asset#IOVsetWithAsset
Parameters:
-
verb
String -
asset
Object
Returns:
Boolean
Defined in: adventure/asset/IOVsetWithClass.js, line 6
Inherited from: adventurejs.Asset#IOVsetWithClass
Parameters:
-
verb
String -
clas
String
Returns:
Boolean
Defined in: adventure/asset/IOVunsetConnection.js, line 6
Inherited from: adventurejs.Asset#IOVunsetConnection
Parameters:
-
verb
String -
asset
Object
Defined in: adventure/asset/isDOV.js, line 6
Inherited from: adventurejs.Asset#isDOV
Parameters:
-
verb
String
Returns:
Boolean
Defined in: adventure/asset/isIOV.js, line 6
Inherited from: adventurejs.Asset#isIOV
Parameters:
-
verb
String
Returns:
Boolean
Defined in: adventure/asset/isVerbState.js, line 6
Inherited from: adventurejs.Asset#isVerbState
Parameters:
-
verb
String
Returns:
Boolean
Defined in: adventure/asset/redirectVerb.js, line 7
Inherited from: adventurejs.Asset#redirectVerb
Parameters:
-
oldVerb
String -
newVerb
String
Defined in: adventure/Atom.js, line 134
Inherited from: adventurejs.Atom#set
Parameters:
-
props
Object
A generic object containing properties to copy to the Object instance.
Returns:
Object
Returns the instance the method is called on (useful for chaining calls.)
Defined in: adventure/asset/setDOV.js, line 7
Inherited from: adventurejs.Asset#setDOV
Parameters:
-
verb
String -
params
Object
setVerbSubscription
with direct object specified.
Defined in: adventure/asset/setDOVs.js, line 7
Inherited from: adventurejs.Asset#setDOVs
Parameters:
-
verb
String -
params
Object
setVerbSubscription
with direct object specified.
Defined in: adventure/asset/setIOV.js, line 7
Inherited from: adventurejs.Asset#setIOV
Parameters:
-
verb
String -
params
Object
setVerbSubscription
with indirect object specified.
Defined in: adventure/asset/setIOVs.js, line 7
Inherited from: adventurejs.Asset#setIOVs
Parameters:
-
verb
String -
params
Object
setVerbSubscription
with indirect object specified.
Defined in: adventure/asset/setObjectOfVerbs.js, line 7
Inherited from: adventurejs.Asset#setObjectOfVerbs
Parameters:
-
object_of
String -
verb
String -
params
Object
setVerbSubscription
.
Defined in: adventure/asset/setVerbSubscription.js, line 6
Inherited from: adventurejs.Asset#setVerbSubscription
Todos: phase out earlier version
Parameters:
-
object_of
String -
verb
String | Object
An early version takes a string, with separate params object. A later version takes an object that includes the verb name as an object key and params as value. -
params
Object
An optional param that works with the earlier version.
- name: '',
- inherited_from: 'Asset',
- enabled: true,
- automatically: false,
- automatically_after_use: false,
- then_disable: false,
- then_destroy: false,
- with_anything: true,
- with_assets: [],
- with_classes: [],
- with_nothing: true,
- with_params: {},
- with_success: '',
Defined in: adventure/asset/setVerbSubscriptionsWithAssets.js, line 6
Inherited from: adventurejs.Asset#setVerbSubscriptionsWithAssets
Parameters:
-
description
String
Returns:
String
Defined in: adventure/asset/setVerbSubscriptionsWithConnection.js, line 6
Inherited from: adventurejs.Asset#setVerbSubscriptionsWithConnection
is.direct_object_of_verb[verb]
and some verbs make connections between assets
that they act upon, which are recorded in
is.direct_object_of_verb[verb].with_params.connections
.
Authors can preset connections in their game file, and
in case they only set one of two connected assets, we want
to ensure that both assets are marked as connected,
so we check that here.
Defined in: adventure/asset/toggleVerbState.js, line 6
Inherited from: adventurejs.Asset#toggleVerbState
Returns:
Boolean
Defined in: adventure/asset/tryEventHook.js, line 6
Inherited from: adventurejs.Asset#tryEventHook
Parameters:
-
hook
string -
asset_name
string
We use asset.name here instead of asset.id in support of authors, because we're never asking them to deal in IDs, only names. Hooks will only be defined by authors, so we let them use asset.name as their identifier. We do however make an effort to see if an id has been passed instead of a name, because Ivan. -
params
object
Arbitrary parameter object.
Returns:
Boolean
Defined in: adventure/asset/undestroy.js, line 7
Inherited from: adventurejs.Asset#undestroy
Defined in: adventure/asset/unredirectVerb.js, line 7
Inherited from: adventurejs.Asset#unredirectVerb
Parameters:
-
oldVerb
String
Defined in: adventure/asset/unsetDOV.js, line 7
Inherited from: adventurejs.Asset#unsetDOV
Parameters:
-
verb
String
unsetVerbSubscription
.
Defined in: adventure/asset/unsetDOVs.js, line 7
Inherited from: adventurejs.Asset#unsetDOVs
Parameters:
-
verbs
Array
unsetVerbSubscription
.
Defined in: adventure/asset/unsetIOV.js, line 7
Inherited from: adventurejs.Asset#unsetIOV
Parameters:
-
verb
String
unsetVerbSubscription
.
Defined in: adventure/asset/unsetIOVs.js, line 7
Inherited from: adventurejs.Asset#unsetIOVs
Parameters:
-
verbs
Array
unsetVerbSubscription
.
Defined in: adventure/asset/unsetVerbSubscription.js, line 6
Inherited from: adventurejs.Asset#unsetVerbSubscription
Parameters:
-
object_of
String -
verb
String
Defined in: adventure/Asset.js, line 750
Inherited from: adventurejs.Asset#validate
Properties Collapse all |
Defined in: adventure/Asset.js, line 422
Inherited from: adventurejs.Asset#adjectives
Defined in: adventure/Asset.js, line 641
Inherited from: adventurejs.Asset#article_name
Defined in: adventure/Asset.js, line 658
Inherited from: adventurejs.Asset#articlename
Todos: this should be a function, not a getter
Defined in: adventure/Asset.js, line 680
Inherited from: adventurejs.Asset#Articlename
Defined in: adventure/Atom.js, line 74
Inherited from: adventurejs.Atom#class
Defined in: adventure/Asset.js, line 293
Inherited from: adventurejs.Asset#collection
Defined in: adventure/Asset.js, line 325
Inherited from: adventurejs.Asset#definite_article
Default value: 'the'
Defined in: adventure/Asset.js, line 603
Inherited from: adventurejs.Asset#definite_name
Defined in: adventure/Asset.js, line 709
Inherited from: adventurejs.Asset#description
Defined in: adventure/Asset.js, line 268
Inherited from: adventurejs.Asset#descriptions
description
is required, all others
are optional. Most of these apply only to Tangible Asset.
descriptions.description
-descriptions.brief
- used for room descriptions if player has typed "brief"descriptions.verbose
- used for room descriptions if player has typed "verbose"descriptions.listen
- used if player types "listen" or "listen to thing"descriptions.in
- used if player types "look in thing"descriptions.through
- used if player types "look through thing"descriptions.smell
- used if player types "smell thing"descriptions.taste
- used if player types "taste thing"descriptions.touch
- used if player types "touch thing"descriptions.careful
- used if player types "carefully examine thing"
Defined in: adventure/Asset.js, line 433
Inherited from: adventurejs.Asset#did_do_verb
Defined in: adventure/Asset.js, line 440
Inherited from: adventurejs.Asset#did_do_verb_count
Defined in: adventure/Asset.js, line 448
Inherited from: adventurejs.Asset#did_try_verb
Defined in: adventure/Asset.js, line 455
Inherited from: adventurejs.Asset#did_try_verb_count
Defined in: adventure/Asset.js, line 352
Inherited from: adventurejs.Asset#dont_use_articles
Default value: false
Defined in: adventure/Asset.js, line 463
Inherited from: adventurejs.Asset#event_hooks
onMoveThatToThis
and onRemoveThatFromThis
events in order
to print a custom message whenever the player character
enters or leaves this particular room.
MyGame.createAsset({
class: "Room",
name: "My Room",
event_hooks: {
onMoveThatToThis:
{
"My Hero": function()
{
MyGame.print("My Hero has come to My Room! ");
}
},
onRemoveThatFromThis:
{
"My Hero": function()
{
MyGame.print("My Hero has left My Room. ");
}
},
},
},
To learn more about event hooks... TODO
Defined in: adventure/Asset.js, line 241
Inherited from: adventurejs.Asset#exclude_from_lookup
Default value: false
Defined in: adventure/Atom.js, line 123
Inherited from: adventurejs.Atom#game
this.game
.
Defined in: adventure/Atom.js, line 100
Inherited from: adventurejs.Atom#game_name
Defined in: adventure/Atom.js, line 86
Inherited from: adventurejs.Atom#id
Defined in: adventure/Asset.js, line 553
Inherited from: adventurejs.Asset#image
Defined in: adventure/Asset.js, line 333
Inherited from: adventurejs.Asset#indefinite_article
Default value: 'a'
Defined in: adventure/Asset.js, line 622
Inherited from: adventurejs.Asset#indefinite_name
Defined in: adventure/Asset.js, line 76
Inherited from: adventurejs.Asset#is
asset.is.state
.
Note that there is also an asset.$is() method which
is related to this, but is a distinct function.
Defined in: adventure/Asset.js, line 187
Inherited from: adventurejs.Asset#is.abstract
Default value: false
Nested property of Is
Defined in: adventure/Asset.js, line 142
Inherited from: adventurejs.Asset#is.collection
Default value: true
Nested property of Is
Defined in: adventure/Asset.js, line 125
Inherited from: adventurejs.Asset#is.destroyed
Default value: false
Nested property of Is
Defined in: adventure/Asset.js, line 87
Inherited from: adventurejs.Asset#is.direct_object_of_verb
Default value: {}
Nested property of Is
Defined in: adventure/Asset.js, line 134
Inherited from: adventurejs.Asset#is.extant
Default value: true
Nested property of Is
Defined in: adventure/Asset.js, line 177
Inherited from: adventurejs.Asset#is.global
Default value: false
Nested property of Is
Defined in: adventure/Asset.js, line 158
Inherited from: adventurejs.Asset#is.initialized
Default value: false
Nested property of Is
Defined in: adventure/Asset.js, line 206
Inherited from: adventurejs.Asset#is.known
Default value: false
Nested property of Is
Todos: In games with multiple characters, any character the player takes will share this knowledge. May want an option to set this per player character.
Defined in: adventure/Asset.js, line 166
Inherited from: adventurejs.Asset#is.nameless
Default value: false
Nested property of Is
Defined in: adventure/assets/Tangible.js, line 181
Inherited from: adventurejs.Asset#is.plugged
Default value: false
Nested property of Is
Defined in: adventure/assets/Tangible.js, line 189
Inherited from: adventurejs.Asset#is.pluggedIn
Default value: false
Nested property of Is
Defined in: adventure/assets/Tangible.js, line 236
Inherited from: adventurejs.Asset#is.seen
Default value: false
Nested property of Is
Todos: In games with multiple characters, any character the player takes will share this knowledge. May want an option to set this per player character.
Defined in: adventure/Asset.js, line 195
Inherited from: adventurejs.Asset#is.singleton
Default value: false
Nested property of Is
Todos: Have only applied this to several special global assets, and have not implemented any code around it. Is it still useful?
Defined in: adventure/assets/Tangible.js, line 256
Inherited from: adventurejs.Asset#is.used
Default value: false
Nested property of Is
Defined in: adventure/Asset.js, line 150
Inherited from: adventurejs.Asset#is.validated
Default value: false
Nested property of Is
Defined in: adventure/Atom.js, line 54
Inherited from: adventurejs.Atom#name
Defined in: adventure/Asset.js, line 308
Inherited from: adventurejs.Asset#name_is_proper
Default value: false
Defined in: adventure/Asset.js, line 363
Inherited from: adventurejs.Asset#noun
Defined in: adventure/Asset.js, line 38
Inherited from: adventurejs.Asset#object_of_verb
asset.setVerbSubscription()
to set individual
assets' relationship to specified verbs.
Each asset.can_be_[in]direct_object_of_verb.verb will receive the
following properties and default values.
- name: '' the name of the verb.
- inherited_from: 'Asset' the name of the class this verb is inherited from. Since these properties aren't distinctly documented, this is offered as a convenience method for tracking down inherited verb settings.
- enabled: true allows changing the state of an object's responsiveness to a given verb.
- automatically: true 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.
- automatically_after_use: true if automatically if set true, this sets it so that a verb can only be applied automatically once a player has already used it.
- then_disable: false if true, asset can only be successfully used once with given verb, but is left in place after use.
- with_anything: true pertains only to indirect objects. If true, this asset can be used as an indirect object of this verb with any direct object.
- with_assets: [] allows author to define a single asset that can interact with this one using the given verb, for example "unlock door with key" where key is the only asset that can unlock door.
- with_classes: [] allows author to define an entire class 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.
- with_nothing: true pertains only to direct objects. If true, the specified verb can be applied to the direct object without the use of any indirect object.
- with_success: '' is an optional parameter. Anything it contains may be appended to the end of the verb's doSuccess output.
- then_destroy: false allows author to specify that this asset should be destroyed after using. If true, asset is destroyed after a single use regardless of how once is set. then_destroy may optionally be stored as an object that appends results to the end of doSuccess:
then_destroy: { with_success: 'foo' }
Defined in: adventure/Asset.js, line 393
Inherited from: adventurejs.Asset#plural
Defined in: adventure/Asset.js, line 227
Inherited from: adventurejs.Asset#print_bold
Default value: false
Defined in: adventure/Asset.js, line 234
Inherited from: adventurejs.Asset#print_italic
Default value: false
Defined in: adventure/Asset.js, line 373
Inherited from: adventurejs.Asset#pronoun
Defined in: adventure/Asset.js, line 315
Inherited from: adventurejs.Asset#propername
Defined in: adventure/Asset.js, line 113
Inherited from: adventurejs.Asset#quirks
quirks.stand_means_get_off
set to true, player
will get off the chair, as opposed to trying to stand in
place on the chair.
Defined in: adventure/Asset.js, line 381
Inherited from: adventurejs.Asset#singlePluralPairs
Defined in: adventure/Asset.js, line 251
Inherited from: adventurejs.Asset#split_name_for_world_lookup
Default value: true
But, an author might want to name a thing, eg, "hole in the ground", in which case we wind up with lookup table entries for "hole" and "in" and "the" and "ground", which is likely to lead to bad input parsing. To avoid name splitting, set split_name_for_world_lookup to false. The object's full name will still be added to the lookup.
Defined in: adventure/Atom.js, line 93
Inherited from: adventurejs.Atom#UID
Defined in: adventure/Asset.js, line 341
Inherited from: adventurejs.Asset#use_definite_article_in_lists
Default value: false
Defined in: adventure/Asset.js, line 498
Inherited from: adventurejs.Asset#verb_hooks
take.doBeforeTry
,
take.doAfterTry
,
take.doBeforeSuccess
,
take.doAfterSuccess
,
and drop.doAfterSuccess
events in order
to print custom messages as the player interacts with this asset.
MyGame.createAsset({
class: "Sword",
name: "singing sword",
verb_hooks: {
take:
{
doBeforeTry: function( params )
{
MyGame.print( "The sword quivers as you reach for
it. ", "concatenate_output" );
},
doAfterTry: function( params )
{
MyGame.print( "The sword begins to vibrate as your hand
curls around its haft. ", "concatenate_output" );
},
doBeforeSuccess: function( params )
{
MyGame.print( "The sword's vibration grows into a hum. ",
"concatenate_output" );
},
doAfterSuccess: function( params )
{
MyGame.print( "The sword bursts into full on song in your hand. ",
"concatenate_output" );
},
},
drop:
{
doAfterSuccess: function( params )
{
MyGame.print( "The sword bursts into a tearful dirge as it
falls to the floor. ", "concatenate_output" );
},
},
},
});
To learn more about verb hooks... TODO