Class: Asset
Extends: adventurejs.Atom
Defined in: adventure/Asset.js, line 5
How to: How to: Assets
Public Constructor:
MyGame.createAsset({ "class":"Asset", "name":"foo" })
Asset is subclassed from the foundational class Atom, and is the most basic game world class from which all other asset classes, Tangible, Substance, and Intangible, are derived. Besides setting the prototypal validation and initialization functions, it also defines many common properties used to determine how assets appear in printed statements. It's unlikely that authors would want to subclass Asset directly as it has few properties, unless it's to create a whole new low-level Asset type.
Private Constructor:
var foo = new adventurejs.Asset(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 Asset 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.
Index
Methods:
- $is
- addWordsToLookup
- aliases
- canSetVerbState
- destroy
- didDoVerbs
- didIoVerbs
- DOVallowOnce
- DOVallowWithAnything
- DOVallowWithAsset
- DOVallowWithNothing
- DOVdidDo
- DOVdidDoCount
- DOVdidTry
- DOVdidTryCount
- DOVgetConnectionCount
- DOVgetConnections
- DOVgetMaxConnections
- DOVhasIndirectObjects
- DOVhasMaxConnections
- DOVincrementDoCount
- DOVincrementTryCount
- DOVisConnectedToAnything
- DOVisConnectedToAsset
- DOVisConnectedToNothing
- DOVsetConnection
- DOVsetWithAsset
- DOVsetWithClass
- DOVunsetConnection
- getDescription
- getDescription
- getIndirectDescription
- Inherited from Atom getInheritance
- Inherited from Atom getProperty
- has
- Inherited from Atom hasClass
- hasDescription
- hasEventHook
- hasIndirectDescription
- Inherited from Atom hasProperty
- incrementDoVerbCount
- incrementTryVerbCount
- initialize
- IOVallowOnce
- IOVallowWithAnything
- IOVallowWithAsset
- IOVallowWithNothing
- IOVdidDo
- IOVdidDoCount
- IOVdidTry
- IOVdidTryCount
- IOVgetConnectionCount
- IOVgetConnections
- IOVgetMaxConnections
- IOVhasDirectObjects
- IOVhasMaxConnections
- IOVincrementDoCount
- IOVincrementTryCount
- IOVisConnectedToAnything
- IOVisConnectedToAsset
- IOVisConnectedToNothing
- IOVsetConnection
- IOVsetWithAsset
- IOVsetWithClass
- IOVunsetConnection
- isDOV
- isIOV
- isVerbState
- redirectVerb
- Inherited from Atom set
- setDOV
- setDOVs
- setIOV
- setIOVs
- setObjectOfVerbs
- setVerbSubscription
- setVerbSubscriptionsWithAssets
- setVerbSubscriptionsWithConnection
- toggleVerbState
- tryEventHook
- undestroy
- unredirectVerb
- unsetDOV
- unsetDOVs
- unsetIOV
- unsetIOVs
- unsetVerbSubscription
- validate
Properties:
- adjectives
- article_name
- articlename
- Articlename
- Inherited from Atom class
- collection
- definite_article
- definite_name
- description
- descriptions
- did_do_verb
- did_do_verb_count
- did_try_verb
- did_try_verb_count
- dont_use_articles
- event_hooks
- exclude_from_lookup
- Inherited from Atom game
- Inherited from Atom game_name
- Inherited from Atom id
- image
- indefinite_article
- indefinite_name
- is
- is.abstract
- is.collection
- is.destroyed
- is.direct_object_of_verb
- is.direct_object_of_verb
- is.extant
- is.global
- is.initialized
- is.known
- is.nameless
- is.plugged
- is.pluggedIn
- is.seen
- is.singleton
- is.used
- is.validated
- Inherited from Atom name
- name_is_proper
- noun
- noun
- noun
- object_of_verb
- plural
- print_bold
- print_italic
- pronoun
- propername
- quirks
- singlePluralPairs
- split_name_for_world_lookup
- Inherited from Atom UID
- use_definite_article_in_lists
- verb_hooks
Methods Collapse all |
Defined in: adventure/asset/_is.js, line 7
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
Parameters:
-
allTheWords
Array -
typeOfWord
String
Defined in: adventure/Asset.js, line 951
Defined in: adventure/asset/canSetVerbState.js, line 6
Parameters:
-
verb
String
Returns:
Boolean
Defined in: adventure/asset/destroy.js, line 7
Todos: What else needs to happen on destroy?
Defined in: adventure/asset/didDoVerbs.js, line 6
Parameters:
-
verbs
Array
Returns:
Boolean
Defined in: adventure/asset/didIoVerbs.js, line 6
Parameters:
-
verbs
Array
Returns:
Boolean
Defined in: adventure/asset/DOVallowOnce.js, line 6
Parameters:
-
verb
String
Returns:
Boolean
Defined in: adventure/asset/DOVallowWithAnything.js, line 6
Parameters:
-
verb
String
Returns:
Boolean
Defined in: adventure/asset/DOVallowWithAsset.js, line 6
Parameters:
-
verb
String -
asset
Object
Returns:
Boolean
Defined in: adventure/asset/DOVallowWithNothing.js, line 6
Parameters:
-
verb
String
Returns:
Boolean
Defined in: adventure/asset/DOVdidDo.js, line 6
Parameters:
-
verb
String
_didDo is an alias meant for authors.
Returns:
Boolean
Defined in: adventure/asset/DOVdidDoCount.js, line 6
Parameters:
-
verb
String
_doCount is an alias meant for authors.
Returns:
Int
Defined in: adventure/asset/DOVdidTry.js, line 6
Parameters:
-
verb
String
_didTry is an alias meant for authors.
Returns:
Boolean
Defined in: adventure/asset/DOVdidTryCount.js, line 6
Parameters:
-
verb
String
_tryCount is an alias meant for authors.
Returns:
Boolean
Defined in: adventure/asset/DOVgetConnectionCount.js, line 6
Parameters:
-
verb
String
The name of a verb.
Returns:
Int
Defined in: adventure/asset/DOVgetConnections.js, line 6
Parameters:
-
verb
String
The name of a verb.
Returns:
Array
Defined in: adventure/asset/DOVgetMaxConnections.js, line 6
Parameters:
-
verb
String
The name of a verb.
Returns:
Int
Defined in: adventure/asset/DOVhasIndirectObjects.js, line 6
Parameters:
-
verb
String
Returns:
Boolean
Defined in: adventure/asset/DOVhasMaxConnections.js, line 6
Parameters:
-
verb
String
The name of a verb.
Returns:
Boolean
Defined in: adventure/asset/DOVincrementDoCount.js, line 6
Parameters:
-
verb
String
Defined in: adventure/asset/DOVincrementTryCount.js, line 6
Parameters:
-
verb
String
Defined in: adventure/asset/DOVisConnectedToAnything.js, line 6
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
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
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
Parameters:
-
verb
String -
asset
Object
Defined in: adventure/asset/DOVsetWithAsset.js, line 6
Parameters:
-
verb
String -
asset
Object
Returns:
Boolean
Defined in: adventure/asset/DOVsetWithClass.js, line 6
Parameters:
-
verb
String -
clas
String
Returns:
Boolean
Defined in: adventure/asset/DOVunsetConnection.js, line 6
Parameters:
-
verb
String -
asset
Object
Defined in: adventure/asset/getDescription.js, line 6
Parameters:
-
description
String
Returns:
String
Defined in: adventure/assets/tangibles/Exit.js, line 951
Parameters:
-
description
String
Returns:
String
Defined in: adventure/asset/getIndirectDescription.js, line 6
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
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
Parameters:
-
description
String
Returns:
String
|
Boolean
Defined in: adventure/asset/hasEventHook.js, line 6
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
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
Parameters:
-
verb
String -
index
Int
Defined in: adventure/asset/incrementTryVerbCount.js, line 6
Parameters:
-
verb
String -
index
Int
Defined in: adventure/Asset.js, line 775
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
Parameters:
-
verb
String
Returns:
Boolean
Defined in: adventure/asset/IOVallowWithAnything.js, line 6
Parameters:
-
verb
String
Returns:
Boolean
Defined in: adventure/asset/IOVallowWithAsset.js, line 6
Parameters:
-
verb
String -
asset
Object
Returns:
Boolean
Defined in: adventure/asset/IOVallowWithNothing.js, line 6
Parameters:
-
verb
String
Returns:
Boolean
Defined in: adventure/asset/IOVdidDo.js, line 6
Parameters:
-
verb
String
_iDidDo is an alias meant for authors.
Returns:
Boolean
Defined in: adventure/asset/IOVdidDoCount.js, line 6
Parameters:
-
verb
String
_iDoCount is an alias meant for authors.
Returns:
Int
Defined in: adventure/asset/IOVdidTry.js, line 6
Parameters:
-
verb
String
_iDidTry is an alias meant for authors.
Returns:
Boolean
Defined in: adventure/asset/IOVdidTryCount.js, line 6
Parameters:
-
verb
String
_iTryCount is an alias meant for authors.
Returns:
Boolean
Defined in: adventure/asset/IOVgetConnectionCount.js, line 6
Parameters:
-
verb
String
The name of a verb.
Returns:
Int
Defined in: adventure/asset/IOVgetConnections.js, line 6
Parameters:
-
verb
String
The name of a verb.
Returns:
Array
Defined in: adventure/asset/IOVgetMaxConnections.js, line 6
Parameters:
-
verb
String
The name of a verb.
Returns:
Int
Defined in: adventure/asset/IOVhasDirectObjects.js, line 6
Parameters:
-
verb
String
Returns:
Boolean
Defined in: adventure/asset/IOVhasMaxConnections.js, line 6
Parameters:
-
verb
String
The name of a verb.
Returns:
Boolean
Defined in: adventure/asset/IOVincrementDoCount.js, line 6
Parameters:
-
verb
String
Defined in: adventure/asset/IOVincrementTryCount.js, line 6
Parameters:
-
verb
String
Defined in: adventure/asset/IOVisConnectedToAnything.js, line 6
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
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
Parameters:
-
verb
String
The name of a verb.
Returns:
Boolean
Defined in: adventure/asset/IOVsetConnection.js, line 6
Parameters:
-
verb
String -
asset
Object
Defined in: adventure/asset/IOVsetWithAsset.js, line 6
Parameters:
-
verb
String -
asset
Object
Returns:
Boolean
Defined in: adventure/asset/IOVsetWithClass.js, line 6
Parameters:
-
verb
String -
clas
String
Returns:
Boolean
Defined in: adventure/asset/IOVunsetConnection.js, line 6
Parameters:
-
verb
String -
asset
Object
Defined in: adventure/asset/isDOV.js, line 6
Parameters:
-
verb
String
Returns:
Boolean
Defined in: adventure/asset/isIOV.js, line 6
Parameters:
-
verb
String
Returns:
Boolean
Defined in: adventure/asset/isVerbState.js, line 6
Parameters:
-
verb
String
Returns:
Boolean
Defined in: adventure/asset/redirectVerb.js, line 7
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
Parameters:
-
verb
String -
params
Object
setVerbSubscription
with direct object specified.
Defined in: adventure/asset/setDOVs.js, line 7
Parameters:
-
verb
String -
params
Object
setVerbSubscription
with direct object specified.
Defined in: adventure/asset/setIOV.js, line 7
Parameters:
-
verb
String -
params
Object
setVerbSubscription
with indirect object specified.
Defined in: adventure/asset/setIOVs.js, line 7
Parameters:
-
verb
String -
params
Object
setVerbSubscription
with indirect object specified.
Defined in: adventure/asset/setObjectOfVerbs.js, line 7
Parameters:
-
object_of
String -
verb
String -
params
Object
setVerbSubscription
.
Defined in: adventure/asset/setVerbSubscription.js, line 6
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
Parameters:
-
description
String
Returns:
String
Defined in: adventure/asset/setVerbSubscriptionsWithConnection.js, line 6
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
Returns:
Boolean
Defined in: adventure/asset/tryEventHook.js, line 6
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
Defined in: adventure/asset/unredirectVerb.js, line 7
Parameters:
-
oldVerb
String
Defined in: adventure/asset/unsetDOV.js, line 7
Parameters:
-
verb
String
unsetVerbSubscription
.
Defined in: adventure/asset/unsetDOVs.js, line 7
Parameters:
-
verbs
Array
unsetVerbSubscription
.
Defined in: adventure/asset/unsetIOV.js, line 7
Parameters:
-
verb
String
unsetVerbSubscription
.
Defined in: adventure/asset/unsetIOVs.js, line 7
Parameters:
-
verbs
Array
unsetVerbSubscription
.
Defined in: adventure/asset/unsetVerbSubscription.js, line 6
Parameters:
-
object_of
String -
verb
String
Defined in: adventure/Asset.js, line 750
Properties Collapse all |
Defined in: adventure/Asset.js, line 422
Defined in: adventure/Asset.js, line 641
Defined in: adventure/Asset.js, line 658
Todos: this should be a function, not a getter
Defined in: adventure/Asset.js, line 680
Defined in: adventure/Atom.js, line 74
Inherited from: adventurejs.Atom#class
Defined in: adventure/Asset.js, line 293
Defined in: adventure/Asset.js, line 325
Default value: 'the'
Defined in: adventure/Asset.js, line 603
Defined in: adventure/Asset.js, line 268
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
Defined in: adventure/Asset.js, line 440
Defined in: adventure/Asset.js, line 448
Defined in: adventure/Asset.js, line 455
Defined in: adventure/Asset.js, line 352
Default value: false
Defined in: adventure/Asset.js, line 463
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
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
Defined in: adventure/Asset.js, line 333
Default value: 'a'
Defined in: adventure/Asset.js, line 622
Defined in: adventure/Asset.js, line 76
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
Default value: false
Nested property of Is
Defined in: adventure/Asset.js, line 142
Default value: true
Nested property of Is
Defined in: adventure/Asset.js, line 125
Default value: false
Nested property of Is
Defined in: adventure/Asset.js, line 87
Default value: {}
Nested property of Is
Defined in: adventure/Asset.js, line 99
Default value: {}
Nested property of Is
Defined in: adventure/Asset.js, line 134
Default value: true
Nested property of Is
Defined in: adventure/Asset.js, line 177
Default value: false
Nested property of Is
Defined in: adventure/Asset.js, line 158
Default value: false
Nested property of Is
Defined in: adventure/Asset.js, line 206
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
Default value: false
Nested property of Is
Defined in: adventure/assets/Tangible.js, line 181
Default value: false
Nested property of Is
Defined in: adventure/assets/Tangible.js, line 189
Default value: false
Nested property of Is
Defined in: adventure/assets/Tangible.js, line 236
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
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
Default value: false
Nested property of Is
Defined in: adventure/Asset.js, line 150
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
Default value: false
Defined in: adventure/Asset.js, line 363
Defined in: adventure/Asset.js, line 402
Defined in: adventure/Asset.js, line 412
Defined in: adventure/Asset.js, line 38
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
Defined in: adventure/Asset.js, line 227
Default value: false
Defined in: adventure/Asset.js, line 234
Default value: false
Defined in: adventure/Asset.js, line 373
Defined in: adventure/Asset.js, line 315
Defined in: adventure/Asset.js, line 113
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
Defined in: adventure/Asset.js, line 251
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
Default value: false
Defined in: adventure/Asset.js, line 498
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