Verb: jump
Instance of: adventurejs.Verb
Defined in: adventure/dictionary/verbs/jump_aspect.js, line 9
How to: How to: VerbSubscriptions VerbAnatomy VerbProcess ModifyVerbs WriteVerbs
> jump over threshold
You jump over the threshold, carrying your new bride, careful to
avoid tripping over your own comically large feet. Your bride runs
her gloved hand through your rainbow colored perm, tickling your nose
with her colorful yellow and fuscia frill. She raises her head for
a kiss, and you mash your brightly painted red lips into hers,
commingling both your makeups into smears of red and white pancake.
You part breathlessly, and she honks your foam nose in connubial bliss.
When used with a preposition, jump requires that the Tangible Asset has an enabled Aspect matching the player's preposition, with its player_can_jump property set to true. No special logic is provided with the verb. Authors wanting to make use of it may need to use a method such as verb hooks. See How to Use Verb Phase Hooks to learn more.
jump sentence structures
Adventurejs uses multiple filtering methods to try to interpret player input. Sentence structures are defined for each verb in order to narrow down the sentence structures that a verb can accept. For example, the verb "hit" might accept "verb noun" as in "hit troll", or "verb noun preposition noun" as in "hit troll with sword", whereas an intransitive verb like "jump" might accept "verb" as a complete sentence. This helps to filter player input. Input that isn't accepted will return a warning to the player.
- It is possible for authors to modify a verb's structures through the use of patchVerb.
- To learn more about modifying verbs, see How to Modify Verbs.
jump phrases
Adventurejs uses multiple filtering methods to try to interpret player input. Phrases are defined for each verb in order to narrow down the words that a verb can accept. This applies to preposition/noun pairs: from zero in the case of intransitive verbs, up to three in the case of verbs that can handle input such as "pour water from jug into basin". The nested noun_must_be object sets conditional qualifiers for nouns, that helps narrow down game objects that the verb might act upon. Input that isn't accepted will return a warning to the player.
- It is possible for authors to modify a verb's phrases through the use of patchVerb.
- To see a list of properties that can be set for phrases, see the Phrase class.
- To see a list of properties that can be set for phrase.noun_must_be, see the NounMustBe class.
- To learn more about modifying verbs, see How to Modify Verbs.
jump params
A verb may have custom params which will be mirrored in the properties of any asset that the verb can be applied to. For example, consider this setting of the verb plugIn:
MyGame.dictionary.verbs.plugIn.with_params.max_connections = 1
By default, assets that can be plugged in will take this setting and can only be plugged in to one other asset. Now imagine that an author wants to create a power cord that needs to be plugged in to both a computer and an outlet.
MyGame.createAsset({
class: "Cable",
name: "power cord",
is: { direct_object_of_verb: { plugIn: { with_assets: ['computer','outlet'], with_params: { max_connections: 2 }, }, }, },
})
MyGame.createAsset({
class: "Computer",
name: "PC",
is: { indirect_object_of_verb: { plugIn: { with_assets: ['power cord'], }, }, },
})
MyGame.createAsset({
class: "ElectricalOutlet",
name: "outlet",
is: { indirect_object_of_verb: { plugIn: { with_assets: ['power cord'], }, }, },
})
The power cord's max_connections setting overrides the verb's max_attachment setting, allowing the player to plug the power cord into two assets, while the computer and the outlet can still have only one asset plugged into them.
- It is possible for authors to modify a verb's params through the use of patchVerb.
- To learn more about modifying verbs, see How to Modify Verbs.
jump event hooks
Verb Event Hooks
provide a method for authors
to hook custom code into particular actions
(or reactions) of a verb. It works by looking for
custom functions attached to the specific assets
that the verb is being applied to, and calling
whatever it finds. It's a fine grained way to
control specific verb/noun interactions.
Each verb has a unique set of event hooks. For
instance, the verb lock
has onTryLock
and
onTryLockThisWithThat
and several other lock-specific hooks.
There are also common event hooks
that are called by multiple verbs. For example, consider
onMoveThatToThis
,
which might be called during the
doSuccess
phase of verbs
give
,
take
,
drop
,
throw
,
move
,
etc.
In this example, imagine that an author would like
the game to print a custom message whenever a certain
object enters or leaves another object, by any method.
MyGame.createAsset({
class: "NPC",
name: "Elvis",
}),
MyGame.createAsset({
class: "Room",
name: "The Building",
event_hooks: {
onMoveThatToThis:
{
"Elvis": function()
{
MyGame.print("Elvis has entered The Building! ");
}
},
onRemoveThatFromThis:
{
"Elvis": function()
{
MyGame.print("Elvis has left The Building! ");
}
},
},
}),
- To learn more, see How to Use Verb Event Hooks.
- Some hooks are not tied to any specific verbs and though these are technically identical, we refer to them as verb effect hooks. See How to Use Verb Effect Hooks for a list of them.
- Verb event Hooks are related to but distinct from verb phase hooks, which allow authors to broadly override entire phases of a verb.
jump verb hooks
do
- doBeforeTry
- doTry
- doAfterTry
- doBeforeSuccess
- doSuccess
- doAfterSuccess
Every verb has a do
function,
and most (but not all) verbs go through six distinct phases.
doTry
handles all the conditional
logic to determine whether this verb can be applied to that asset.
doSuccess
handles the output and
state changes. The other four phases don't do anything by themselves;
they exist to allow authors to inject custom code via the use of
Verb Phase Hooks.
This is a broad method for exercising control over verb/noun
interactions.
For example, consider the verb "take" as applied to this singing
sword. Imagine that an author wants the game to print a custom message
when the player tries to take the sword, and a different message
when the player succeeds in taking it.
MyGame.createAsset({
class: "Sword",
name: "singing sword",
verb_hooks: {
take:
{
doAfterTry: function( params )
{
MyGame.print( "The sword begins to vibrate as your hand
curls around its haft. ", "concatenate_output" );
},
doAfterSuccess: function( params )
{
MyGame.print( "The sword bursts into song in your hand. ",
"concatenate_output" );
},
},
},
});
- Verb Phase Hooks are related to but distinct from Verb Event Hooks, which are a more surgical option that allows authors to hook into specific events within doTry and doSuccess.
- To learn more, see How to Use Verb Phase Hooks.
Private Constructor:
MyGame.createVerb({ "name": "jump", [...] });
jump is a predefined instance of Verb that gets constructed automatically at runtime. It is defined in the library as a generic object, and then passed to Dictionary#createVerb for construction, validation, and initialization. Because this is predefined, authors should not need to create new instances. For information on modifying predefined Verbs, see How to Modify Verbs.
Index
Methods:
- Inherited from Verb Overrides from Verb canBeIntransitive
- Inherited from Verb Overrides from Verb do
- Inherited from Verb Overrides from Verb doAfterSuccess
- Inherited from Verb Overrides from Verb doAfterTry
- Inherited from Verb Overrides from Verb doBeforeSuccess
- Inherited from Verb Overrides from Verb doBeforeTry
- Inherited from Verb Overrides from Verb doSuccess
- Inherited from Verb Overrides from Verb doTry
- Inherited from Verb Overrides from Verb enqueueCollection
- Inherited from Verb Overrides from Verb getState
- Inherited from Verb Overrides from Verb handleFailure
- Inherited from Verb Overrides from Verb handleSuccess
- Inherited from Verb Overrides from Verb hasState
- Inherited from Verb Overrides from Verb hasVerbSubscriptionConnection
- Inherited from Verb Overrides from Verb initialize
- Inherited from Verb Overrides from Verb set
- Inherited from Verb Overrides from Verb setVerbSubscriptionConnection
- Inherited from Verb Overrides from Verb tryDestroyAfterUsing
- Inherited from Verb Overrides from Verb tryDestroyDirectObjectAfterUsing
- Inherited from Verb Overrides from Verb tryDestroyIndirectObjectAfterUsing
- Inherited from Verb Overrides from Verb tryPlaceAssetInAspectOfAsset
- Inherited from Verb Overrides from Verb tryToInferIndirectObject
- Inherited from Verb Overrides from Verb unsetVerbSubscriptionConnection
- Inherited from Verb Overrides from Verb validate
Properties:
- Inherited from Verb Overrides from Verb accepts_direction
- Inherited from Verb Overrides from Verb accepts_number
- Inherited from Verb Overrides from Verb accepts_string
- Inherited from Verb Overrides from Verb adjectives
- Inherited from Verb Overrides from Verb dictionary
- Inherited from Verb Overrides from Verb direction_preposition
- Inherited from Verb Overrides from Verb game
- Inherited from Verb Overrides from Verb in_can_mean_on
- Inherited from Verb Overrides from Verb input_substitutions
- Inherited from Verb Overrides from Verb is_compass_direction
- Inherited from Verb Overrides from Verb is_direction
- Inherited from Verb Overrides from Verb is_relative_direction
- Inherited from Verb Overrides from Verb let_verb_handle_disambiguation
- Inherited from Verb Overrides from Verb let_verb_handle_remaining_input
- Inherited from Verb Overrides from Verb name
- Inherited from Verb Overrides from Verb Name
- Inherited from Verb Overrides from Verb onDoFromThis
- Inherited from Verb Overrides from Verb onDoThatFromThis
- Inherited from Verb Overrides from Verb onDoThatWithThis
- Inherited from Verb Overrides from Verb onDoThis
- Inherited from Verb Overrides from Verb onDoThisFromThat
- Inherited from Verb Overrides from Verb onDoThisWithThat
- Inherited from Verb Overrides from Verb onDoWithThis
- Inherited from Verb Overrides from Verb onTryFromThis
- Inherited from Verb Overrides from Verb onTryThatFromThis
- Inherited from Verb Overrides from Verb onTryThatWithThis
- Inherited from Verb Overrides from Verb onTryThis
- Inherited from Verb Overrides from Verb onTryThisFromThat
- Inherited from Verb Overrides from Verb onTryThisWithThat
- Inherited from Verb Overrides from Verb onTryWithThis
- Inherited from Verb Overrides from Verb override_verb_failure_msg
- Inherited from Verb Overrides from Verb override_verb_success_msg
- Inherited from Verb Overrides from Verb past_tense
- Inherited from Verb Overrides from Verb player_must_be
- Inherited from Verb Overrides from Verb prettyname
- Inherited from Verb Overrides from Verb related
- Inherited from Verb Overrides from Verb requires_number
- Inherited from Verb Overrides from Verb requires_string
- Inherited from Verb Overrides from Verb state
- Inherited from Verb Overrides from Verb state_strings
- Inherited from Verb Overrides from Verb synonyms
- Inherited from Verb Overrides from Verb unstate
- Inherited from Verb Overrides from Verb verb_noun_prep
- Inherited from Verb Overrides from Verb verb_noun_prep_noun
- Inherited from Verb Overrides from Verb verb_noun_prep_noun_prep_noun
- Inherited from Verb Overrides from Verb verb_noun_prep_prep_noun
- Inherited from Verb Overrides from Verb verb_prep_noun
- Inherited from Verb Overrides from Verb verb_prep_noun_prep_noun
- Inherited from Verb Overrides from Verb verb_prep_noun_prep_noun_prep_noun
- Inherited from Verb Overrides from Verb verb_prep_prep_noun
- Inherited from Verb Overrides from Verb verb_prep_prep_prep_noun
Methods Collapse all |
Defined in: adventure/dictionary/Verb.js, line 1993
Overrides from: adventurejs.Verb#canBeIntransitive
Defined in: adventure/dictionary/Verb.js, line 1022
Overrides from: adventurejs.Verb#do
do ->
- doBeforeTry (hook for authors)
- doTry
- doAfterTry (hook for authors)
- doBeforeSuccess (hook for authors)
- doSuccess
- doAfterSuccess (hook for authors)
A Verb instance isn't required to use all of these methods. Some Verbs may bypass Verb.doTry because no special conditions are required to apply the Verb. Some specialized Verbs such as oops and undo override Verb.do entirely and don't use any submethods.
The other four submethods – Verb.doBeforeTry, Verb.doAfterTry, Verb.doBeforeSuccess, and Verb.doAfterSuccess – exist to provide optional hooks for authors to add custom interactions with individual Assets. For more information about Verb Event Hooks and Verb Phase Hooks, see How to Use Verb Event Hooks and How to Use Verb Phase Hooks.
And so, the first thing Verb.do does is to verify that each method exists on the Verb instance. If the submethod exists, it is called. Each submethod sends a return to Verb.do.
If the Verb is acting on a collection, a false return means that the Asset currently being acted on has responded in a way that blocks further parsing, and brings this turn to a halt. A null return means that the Asset currently being acted on has concluded its own parsing, but not in such a way as to block further parsing, and Verb.do moves on to the next Asset.
Defined in: adventure/dictionary/Verb.js, line 1369
Overrides from: adventurejs.Verb#doAfterSuccess
Defined in: adventure/dictionary/Verb.js, line 1253
Overrides from: adventurejs.Verb#doAfterTry
Defined in: adventure/dictionary/Verb.js, line 1304
Overrides from: adventurejs.Verb#doBeforeSuccess
Defined in: adventure/dictionary/Verb.js, line 1188
Overrides from: adventurejs.Verb#doBeforeTry
Defined in: adventure/dictionary/Verb.js, line 1351
Overrides from: adventurejs.Verb#doSuccess
Defined in: adventure/dictionary/Verb.js, line 1236
Overrides from: adventurejs.Verb#doTry
Defined in: adventure/dictionary/Verb.js, line 1716
Overrides from: adventurejs.Verb#enqueueCollection
Defined in: adventure/dictionary/Verb.js, line 2014
Overrides from: adventurejs.Verb#getState
Defined in: adventure/dictionary/Verb.js, line 1760
Overrides from: adventurejs.Verb#handleFailure
Defined in: adventure/dictionary/Verb.js, line 1839
Overrides from: adventurejs.Verb#handleSuccess
Defined in: adventure/dictionary/Verb.js, line 2004
Overrides from: adventurejs.Verb#hasState
Defined in: adventure/dictionary/Verb.js, line 2115
Overrides from: adventurejs.Verb#hasVerbSubscriptionConnection
Defined in: adventure/dictionary/Verb.js, line 1673
Overrides from: adventurejs.Verb#initialize
Todos: How does patchVerb handle initialization?
Defined in: adventure/dictionary/Verb.js, line 1747
Overrides from: adventurejs.Verb#set
Parameters:
-
props
Object
A generic object containing properties to copy to the DisplayObject instance.
Defined in: adventure/dictionary/Verb.js, line 2024
Overrides from: adventurejs.Verb#setVerbSubscriptionConnection
computer.is.direct_object_of_verb.plugIn.with_params.connections = ['socket']
socket.is.indirect_object_of_verb.plugIn.with_params.connections = ['computer']
This is one of two verb subscription properties that are related and very similar, and it's important to understand the distinction between them.
...with_assets
defines which assets CAN BE connected.
...with_params.connections
stores which assets ARE connected.
with_assets:
computer.is.direct_object_of_verb.plugIn.with_assets = ['socket']
connections:
computer.is.direct_object_of_verb.plugIn.with_params.connections = ['socket']
Defined in: adventure/asset/tryDestroyAfterUsing.js, line 7
Overrides from: adventurejs.Verb#tryDestroyAfterUsing
Parameters:
-
object_of
String -
asset
Object
Returns:
Object
Defined in: adventure/asset/tryDestroyDirectObjectAfterUsing.js, line 7
Overrides from: adventurejs.Verb#tryDestroyDirectObjectAfterUsing
Parameters:
-
asset
Object
asset.is.direct_object_of_verb[this.name].then_destroy
.
This is intended to provide a hook for authors
to easily destroy an object after a single use, such as a key
that only works once and then breaks or disappears.
Returns:
Boolean
|
string
Defined in: adventure/asset/tryDestroyIndirectObjectAfterUsing.js, line 7
Overrides from: adventurejs.Verb#tryDestroyIndirectObjectAfterUsing
Parameters:
-
asset
Object
asset.is.indirect_object_of_verb[this.name].then_destroy
.
This is intended to provide a hook for authors
to easily destroy an object after a single use, such as a key
that only works once and then breaks or disappears.
Returns:
Boolean
|
string
Defined in: adventure/dictionary/Verb.js, line 1465
Overrides from: adventurejs.Verb#tryPlaceAssetInAspectOfAsset
Parameters:
-
direct_object
Object -
preposition
String -
indirect_object
Object
Returns:
Object
Defined in: adventure/dictionary/Verb.js, line 1411
Overrides from: adventurejs.Verb#tryToInferIndirectObject
Parameters:
-
direct_object
Object
Returns:
Object
Defined in: adventure/dictionary/Verb.js, line 2077
Overrides from: adventurejs.Verb#unsetVerbSubscriptionConnection
computer.is.direct_object_of_verb.plugIn.with_params.connections = ['socket']
socket.is.indirect_object_of_verb.plugIn.with_params.connections = ['computer']
Defined in: adventure/dictionary/Verb.js, line 1662
Overrides from: adventurejs.Verb#validate
Properties Collapse all |
Defined in: adventure/dictionary/Phrase.js, line 27
Overrides from: adventurejs.Verb#accepts_direction
Defined in: adventure/dictionary/Phrase.js, line 41
Overrides from: adventurejs.Verb#accepts_number
Defined in: adventure/dictionary/Phrase.js, line 20
Overrides from: adventurejs.Verb#accepts_string
Defined in: adventure/dictionary/Verb.js, line 231
Overrides from: adventurejs.Verb#adjectives
Defined in: adventure/dictionary/Verb.js, line 144
Overrides from: adventurejs.Verb#dictionary
Default value: {}
Defined in: adventure/dictionary/Verb.js, line 309
Overrides from: adventurejs.Verb#direction_preposition
Default value: ""
Defined in: adventure/dictionary/Verb.js, line 137
Overrides from: adventurejs.Verb#game
Default value: {}
Defined in: adventure/dictionary/Verb.js, line 276
Overrides from: adventurejs.Verb#in_can_mean_on
Default value: false
Defined in: adventure/dictionary/Verb.js, line 326
Overrides from: adventurejs.Verb#input_substitutions
Default value: {}
Defined in: adventure/dictionary/Verb.js, line 292
Overrides from: adventurejs.Verb#is_compass_direction
Default value: false
Defined in: adventure/dictionary/Verb.js, line 285
Overrides from: adventurejs.Verb#is_direction
Default value: false
Defined in: adventure/dictionary/Verb.js, line 300
Overrides from: adventurejs.Verb#is_relative_direction
Default value: false
Defined in: adventure/dictionary/Verb.js, line 256
Overrides from: adventurejs.Verb#let_verb_handle_disambiguation
Default value: false
Defined in: adventure/dictionary/Verb.js, line 265
Overrides from: adventurejs.Verb#let_verb_handle_remaining_input
Default value: false
Defined in: adventure/dictionary/Verb.js, line 152
Overrides from: adventurejs.Verb#name
Default value: ""
Defined in: adventure/dictionary/Verb.js, line 376
Overrides from: adventurejs.Verb#Name
Default value: []
Defined in: adventure/dictionary/Verb.js, line 442
Overrides from: adventurejs.Verb#onDoFromThis
Defined in: adventure/dictionary/Verb.js, line 477
Overrides from: adventurejs.Verb#onDoThatFromThis
Defined in: adventure/dictionary/Verb.js, line 463
Overrides from: adventurejs.Verb#onDoThatWithThis
Defined in: adventure/dictionary/Verb.js, line 435
Overrides from: adventurejs.Verb#onDoThis
Defined in: adventure/dictionary/Verb.js, line 470
Overrides from: adventurejs.Verb#onDoThisFromThat
Defined in: adventure/dictionary/Verb.js, line 456
Overrides from: adventurejs.Verb#onDoThisWithThat
Defined in: adventure/dictionary/Verb.js, line 449
Overrides from: adventurejs.Verb#onDoWithThis
Defined in: adventure/dictionary/Verb.js, line 398
Overrides from: adventurejs.Verb#onTryFromThis
Defined in: adventure/dictionary/Verb.js, line 426
Overrides from: adventurejs.Verb#onTryThatFromThis
Defined in: adventure/dictionary/Verb.js, line 412
Overrides from: adventurejs.Verb#onTryThatWithThis
Defined in: adventure/dictionary/Verb.js, line 384
Overrides from: adventurejs.Verb#onTryThis
Defined in: adventure/dictionary/Verb.js, line 419
Overrides from: adventurejs.Verb#onTryThisFromThat
Defined in: adventure/dictionary/Verb.js, line 405
Overrides from: adventurejs.Verb#onTryThisWithThat
Defined in: adventure/dictionary/Verb.js, line 391
Overrides from: adventurejs.Verb#onTryWithThis
Defined in: adventure/dictionary/Verb.js, line 345
Overrides from: adventurejs.Verb#override_verb_failure_msg
Default value: undefined
Defined in: adventure/dictionary/Verb.js, line 354
Overrides from: adventurejs.Verb#override_verb_success_msg
Default value: undefined
Defined in: adventure/dictionary/Verb.js, line 171
Overrides from: adventurejs.Verb#past_tense
Defined in: adventure/dictionary/Verb.js, line 239
Overrides from: adventurejs.Verb#player_must_be
Default value: {}
Defined in: adventure/dictionary/Verb.js, line 162
Overrides from: adventurejs.Verb#prettyname
Defined in: adventure/dictionary/Phrase.js, line 48
Overrides from: adventurejs.Verb#requires_number
Defined in: adventure/dictionary/Phrase.js, line 34
Overrides from: adventurejs.Verb#requires_string
Defined in: adventure/dictionary/Verb.js, line 178
Overrides from: adventurejs.Verb#state
state
is an optional property for verbs that apply
state to assets, such as close and lock. For example, "close door"
will set door.is.closed to true. When used, state will contain the
state to be set true on an asset. In the case of close, its state
would be "closed".
Defined in: adventure/dictionary/Verb.js, line 198
Overrides from: adventurejs.Verb#state_strings
state_strings
is an optional property for verbs that is
used to provide string substitutions for authors using the string
substitution form of $(sink drain is plugged or unplugged).
Because "unplugged" isn't a proper verb state, we'll use this as a
reverse lookup to test whether the asset, sink_drain in this case,
is subscribed to the relevant verb and has the specified state.
state_strings only apply to direct objects.
Defined in: adventure/dictionary/Verb.js, line 485
Overrides from: adventurejs.Verb#synonyms
Default value: []
Defined in: adventure/dictionary/Verb.js, line 188
Overrides from: adventurejs.Verb#unstate
unstate
is an optional property for verbs that unset
state from assets, such as open and unlock. For example, "open door"
will set door.is.closed to false. When used, unstate will contain the
state to be set false on an asset. In the case of open, its unstate
would be "closed".
Defined in: adventure/dictionary/Verb.js, line 567
Overrides from: adventurejs.Verb#verb_noun_prep
Default value: []
Defined in: adventure/dictionary/Verb.js, line 773
Overrides from: adventurejs.Verb#verb_noun_prep_noun
Default value: []
Though verb_prep_noun and verb_noun_prep_noun look similar, the reason they are separate fields is because we have to use different regex patterns to find each type in user input.
Defined in: adventure/dictionary/Verb.js, line 883
Overrides from: adventurejs.Verb#verb_noun_prep_noun_prep_noun
Default value: []
Defined in: adventure/dictionary/Verb.js, line 830
Overrides from: adventurejs.Verb#verb_noun_prep_prep_noun
Default value: []
Defined in: adventure/dictionary/Verb.js, line 620
Overrides from: adventurejs.Verb#verb_prep_noun
Default value: []
Defined in: adventure/dictionary/Verb.js, line 517
Overrides from: adventurejs.Verb#verb_prep_noun_prep_noun
Default value: []
Defined in: adventure/dictionary/Verb.js, line 936
Overrides from: adventurejs.Verb#verb_prep_noun_prep_noun_prep_noun
Default value: []
Defined in: adventure/dictionary/Verb.js, line 673
Overrides from: adventurejs.Verb#verb_prep_prep_noun
Default value: []
Defined in: adventure/dictionary/Verb.js, line 723
Overrides from: adventurejs.Verb#verb_prep_prep_prep_noun
Default value: []