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

Defined in: adventure/Dictionary.js, line 5

Framework class

Description

Dictionary manages all Verbs and Verb related functions. It also manages lookup tables for Verbs, nouns, directions, and sentence patterns. A Dictionary instance is created automatically by Game at runtime. There is no public constructor, and authors should not need to make new instances.

Private Constructor:

var foo = new adventurejs.Dictionary(game)

Parameters:

  • game Game
    A reference to the game instance.
Inherited Overrides

Methods Collapse all  |  Expand all

combineVerbs
combineVerbs(pushVerbs, intoVerb)

Defined in: adventure/dictionary/combineVerbs.js, line 8

Parameters:

  • pushVerbs String
  • intoVerb String
combineVerbs is a method to allow authors to consolidate verbs. For example, consider move and push. These verbs are almost identical and only exist here as distinct verbs because it seems that "push character" has a very different connotation than "move character". Authors who find the distinction unhelpful may want to combine them so they don't have to write custom responses for both verbs. What combineVerbs does under the hood is delete the verb(s) provided in the first param and add their synonyms to the verb provided in the second param.
createVerb
createVerb(preverb) → {Verb}

Defined in: adventure/dictionary/createVerb.js, line 8

Parameters:

  • preverb object
    A generic object.
Native verbs are stored as non-classed objects, aka preverbs. This method calls the Verb() constructor and passes data from preverb to verb, then adds the new verb to game.dictionary.verbs.

Returns:

Verb The constructed verb
disableAllVerbsBut
disableAllVerbsBut(enabled_verbs)

Defined in: adventure/dictionary/disableAllVerbsBut.js, line 8

Parameters:

  • enabled_verbs Array
A method to allow authors to consolidate verbs.
disableVerbs
disableVerbs(disabled_verbs)

Defined in: adventure/dictionary/disableVerbs.js, line 8

Parameters:

  • disabled_verbs String | Array
A method to allow authors to disable specific verbs.
doVerb
doVerb(verb)

Defined in: adventure/dictionary/doVerb.js, line 8

Parameters:

  • verb String
Passthrough method to call a verb.
enableVerbs
enableVerbs(disabled_verbs)

Defined in: adventure/dictionary/enableVerbs.js, line 8

Parameters:

  • disabled_verbs Array | String
A method to allow authors to reenable verbs.
getAdjective
getAdjective(preposition) → {String|Boolean}

Defined in: adventure/Dictionary.js, line 238

Parameters:

  • preposition String
Determine whether string is recognized as an getAdjective and return the string.

Returns:

String | Boolean
getAdverb
getAdverb(preposition) → {String|Boolean}

Defined in: adventure/Dictionary.js, line 209

Parameters:

  • preposition String
Determine whether string is recognized as an adverb and return the string.

Returns:

String | Boolean
getDirection
getDirection(word) → {String}

Defined in: adventure/dictionary/getDirection.js, line 8

Parameters:

  • word String
    A direction name. Directions can have aliases, for example 'ne' as a shortcut for 'northeast'. When player inputs an alias, we want to lookup the primary name, which we need to get the direction object.

Returns:

String The primary direction name.
getPreposition
getPreposition(preposition) → {String|Boolean}

Defined in: adventure/Dictionary.js, line 196

Parameters:

  • preposition String
Determine whether string is recognized as a preposition and return the string.

Returns:

String | Boolean
getPronoun
getPronoun(pronoun)

Defined in: adventure/dictionary/getPronoun.js, line 8

Framework class

Parameters:

  • pronoun String
Takes a plural pronoun token and converts to the equivalent person pronoun according to game.settings.person.
getStringLookup
getStringLookup(type, value) → {string}

Defined in: adventure/dictionary/string_lookup.js, line 134

Parameters:

  • type string
    The type to look up, ie "prepositions" or "posture_gerunds".
  • value string
    The value to look up, ie "standing" or "0.1".

Returns:

string
getStringLookupByRange
getStringLookupByRange(type, value) → {string}

Defined in: adventure/dictionary/string_lookup.js, line 246

Parameters:

  • type string
    The type to look up, ie "prepositions" or "posture_gerunds".
  • value string | number
    The numerical value to look up, ie "70" or "0.1".

Returns:

string
getVerb
getVerb(verb) → {object}

Defined in: adventure/dictionary/getVerb.js, line 8

Parameters:

  • verb String
A method to get a dictionary verb object from a verb name string.

Returns:

object
hasCommonWord
hasCommonWord(word) → {boolean}

Defined in: adventure/dictionary/common_words.js, line 8

Parameters:

  • word string
    The word to look up, ie "zoo".
Ask whether the common word dictionary contains the specified word.

Returns:

boolean
initStandardVerbs
initStandardVerbs()

Defined in: adventure/Dictionary.js, line 168

Framework class

Construct all native verbs. When complete, sets game.dictionary.did_initialize_verbs to true.
isDirection
isDirection(word) → {Boolean}

Defined in: adventure/dictionary/isDirection.js, line 8

Parameters:

  • word String
    A string to be evaluated.
Is this a direction?

Returns:

Boolean
isPreposition
isPreposition(preposition) → {Boolean}

Defined in: adventure/Dictionary.js, line 183

Parameters:

  • preposition String
Determine whether string is recognized as a preposition.

Returns:

Boolean
patchVerb
patchVerb(patchVerb)

Defined in: adventure/dictionary/patchVerb.js, line 8

Parameters:

  • patchVerb Object
A method to allow authors to revise predefined verbs.
replaceVerb
replaceVerb(oldVerb, newVerb)

Defined in: adventure/dictionary/replaceVerb.js, line 8

Parameters:

  • oldVerb String
  • newVerb Object
set
set(props) → {adventurejs.Dictionary}

Defined in: adventure/Dictionary.js, line 251

Parameters:

  • props Object
    A generic object containing properties to copy to the instance.
Provides a chainable shortcut method for setting a number of properties on the instance.

Returns:

adventurejs.Dictionary Returns the instance the method is called on (useful for chaining calls.)
set
set(props) → {adventurejs.Dictionary}

Defined in: adventure/dictionary/set.js, line 8

Parameters:

  • props Object
    A generic object containing properties to copy to the DisplayObject instance.
Provides a chainable shortcut method for setting a number of properties on the instance.

Returns:

adventurejs.Dictionary Returns the instance the method is called on (useful for chaining calls.)
setStringLookup
setStringLookup(type, values) → {boolean}

Defined in: adventure/dictionary/string_lookup.js, line 183

Parameters:

  • type string
    The type to set, ie "prepositions" or "posture_gerunds".
  • values object
    An object containing values to set, ie {"standing":"standing up"} or {"0":"empty","1":"full"}.

Returns:

boolean
testVerbSynonyms
testVerbSynonyms(word1) → {Verb}

Defined in: adventure/dictionary/testVerbSynonyms.js, line 8

Parameters:

  • word1 String
    An unclassed verb object.
Takes two verb names and checks to see if they're synonyms.

Returns:

Verb The constructed verb

Properties  | 

adjectives
adjectives :Object

Defined in: adventure/dictionary/adjectives.js, line 8

Adjectives recognized by the parser.
adverbs
adverbs :Object

Defined in: adventure/dictionary/adverbs.js, line 8

Adverbs are supported in a small way. Adverbs are especially tricky to parse because many words such as on and off may be used as adverbs or prepositions. To favor simplicity, adventurejs treats most of those ambiguous words as prepositions, but it does handle a few obvious "-ly" words such as carefully and quietly.
aspects
aspects :Object

Defined in: adventure/dictionary/aspects.js, line 8

Prepositions that are recognized as tangible aspects.
common_words
common_words :Object

Defined in: adventure/dictionary/common_words.js, line 20

Common words is a group of words that may not exist in the game, but which a player could reasonably be expected to use, for which we may want to return a more informative message than "I don't know the word x." Authors can provide their own lists of common words, or set the list to empty, through the use of MyGame.dictionary.set({ common_words: ["foo", "bar"] });
compound_prepositions
compound_prepositions :Object

Defined in: adventure/dictionary/compound_prepositions.js, line 8

Compound prepositions are converted to single words by the parser.
did_initialize_verbs
did_initialize_verbs :Boolean

Defined in: adventure/Dictionary.js, line 71

Default value: false

Boolean used to determine if we've initialize all predefined verbs.
direction_lookup
direction_lookup :Object

Defined in: adventure/Dictionary.js, line 38

Default value: {}

Runtime node: game.dictionary.direction_lookup

Lookup table for direction keywords.
directions
directions :Object

Defined in: adventure/Dictionary.js, line 30

Default value: {}

Todos: Is this irrelevant?

Unused?
disabled_verbs
disabled_verbs :Array

Defined in: adventure/Dictionary.js, line 63

Default value: []

When using disableVerbs, save the disabled verb IDs here.
enabled_verbs
enabled_verbs :Array

Defined in: adventure/Dictionary.js, line 55

Default value: []

When using disableAllVerbsBut, save the enabled verb IDs here.
exit_prepositions
exit_prepositions :Object

Defined in: adventure/dictionary/exit_prepositions.js, line 8

Exit prepositions are used to describe leaving a nested position.
fail_adverbs
fail_adverbs :Object

Defined in: adventure/dictionary/fail_adverbs.js, line 8

A list of adverbs that can be used randomly in negative responses.
fail_adverbs
fail_adverbs :Object

Defined in: adventure/dictionary/success_adverbs.js, line 8

A list of adverbs that can be used randomly in positive responses.
game
game :Object

Defined in: adventure/Dictionary.js, line 23

Default value: {}

A reference back to the main Game object.
if_input_is_empty_print_this
if_input_is_empty_print_this :*

Defined in: adventure/Settings.js, line 286

if_input_is_empty_print_this can return string or array or function.
postures
postures :Object

Defined in: adventure/dictionary/postures.js, line 8

Postures that can be applied to Characters.
prepositions
prepositions :Object

Defined in: adventure/dictionary/prepositions.js, line 8

These prepositions are recognized by the parser. Some are the result of compound operations such as outfromunder.
pretty_exit_prepositions
pretty_exit_prepositions :Object

Defined in: adventure/dictionary/pretty_exit_prepositions.js, line 8

Pretty exit prepositions are used to describe leaving a nested position.
pronouns
pronouns :Object

Defined in: adventure/dictionary/pronouns.js, line 8

We use the pronouns for first person plural as a lookup key to get pronouns for other cases. Pronoun groups include language for first person, first person plural (plural), second person, third person plural (nonbinary), third person male, third person female, and nonhuman. We also lump in some contractions and modal verbs. These can be applied to all of the default response strings built-in to AdventureJS, by setting the person property.
string_lookup
string_lookup :Object

Defined in: adventure/dictionary/string_lookup.js, line 8

Default value: {}

A lookup table for strings to describe ranges, such as temperature.
verb_lookup
verb_lookup :Object

Defined in: adventure/Dictionary.js, line 78

Default value: {}

A lookup table for verb keywords.
verb_noun_prep_noun_prep_nouns
verb_noun_prep_noun_prep_nouns :Array

Defined in: adventure/Dictionary.js, line 135

Default value: []

We store a variety of verb/noun/preposition patterns per verb, which we compare against when searching player input.
verb_noun_prep_nouns
verb_noun_prep_nouns :Array

Defined in: adventure/Dictionary.js, line 119

Default value: []

We store a variety of verb/noun/preposition patterns per verb, which we compare against when searching player input.
verb_noun_prep_prep_nouns
verb_noun_prep_prep_nouns :Array

Defined in: adventure/Dictionary.js, line 127

Default value: []

We store a variety of verb/noun/preposition patterns per verb, which we compare against when searching player input.
verb_noun_preps
verb_noun_preps :Array

Defined in: adventure/Dictionary.js, line 87

Default value: []

We store a variety of verb/noun/preposition patterns per verb, which we compare against when searching player input.
verb_prep_noun_prep_noun_prep_nouns
verb_prep_noun_prep_noun_prep_nouns :Array

Defined in: adventure/Dictionary.js, line 151

Default value: []

We store a variety of verb/noun/preposition patterns per verb, which we compare against when searching player input.
verb_prep_noun_prep_nouns
verb_prep_noun_prep_nouns :Array

Defined in: adventure/Dictionary.js, line 143

Default value: []

We store a variety of verb/noun/preposition patterns per verb, which we compare against when searching player input.
verb_prep_nouns
verb_prep_nouns :Array

Defined in: adventure/Dictionary.js, line 95

Default value: []

We store a variety of verb/noun/preposition patterns per verb, which we compare against when searching player input.
verb_prep_prep_nouns
verb_prep_prep_nouns :Array

Defined in: adventure/Dictionary.js, line 103

Default value: []

We store a variety of verb/noun/preposition patterns per verb, which we compare against when searching player input.
verb_prep_prep_prep_nouns
verb_prep_prep_prep_nouns :Array

Defined in: adventure/Dictionary.js, line 111

Default value: []

We store a variety of verb/noun/preposition patterns per verb, which we compare against when searching player input.
verb_state_lookup
verb_state_lookup :Object

Defined in: adventure/Dictionary.js, line 159

A placeholder for verbs to write their state/unstate strings to for lookup..
verbs
verbs :Object

Defined in: adventure/Dictionary.js, line 46

Default value: {}

Runtime node: game.dictionary.verbs

Container for all constructed instance of Verb.