Adventure.js Docs Downloads
Score: 0 Moves: 0

Class: Dictionary

Defined in: adventure/Dictionary.js, line 6

Framework class

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
IndexMethodsProperties

Methods Collapse all  |  Expand all

combineVerbs(pushVerbs, intoVerb)

Defined in: adventure/Dictionary.js, line 568

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(preverb) → {Verb}

Defined in: adventure/Dictionary.js, line 485

Parameters:

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

Returns:

Verb The constructed verb
disableAllVerbsBut(enabled_verbs)

Defined in: adventure/Dictionary.js, line 682

Parameters:

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

Defined in: adventure/Dictionary.js, line 655

Parameters:

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

Defined in: adventure/Dictionary.js, line 535

Parameters:

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

Defined in: adventure/Dictionary.js, line 626

Parameters:

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

Defined in: adventure/Dictionary.js, line 802

Parameters:

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

Returns:

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

Defined in: adventure/Dictionary.js, line 788

Parameters:

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

Returns:

String | Boolean
getDirection(word) → {String}

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

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(preposition) → {String|Boolean}

Defined in: adventure/Dictionary.js, line 774

Parameters:

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

Returns:

String | Boolean
getPronoun(pronoun)

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

Framework class

Parameters:

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

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

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(type, value) → {string}

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

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
initStandardVerbs()

Defined in: adventure/Dictionary.js, line 467

Framework class

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

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

Parameters:

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

Returns:

Boolean
isPreposition(preposition) → {Boolean}

Defined in: adventure/Dictionary.js, line 760

Parameters:

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

Returns:

Boolean
patchVerb(patchVerb)

Defined in: adventure/Dictionary.js, line 711

Parameters:

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

Defined in: adventure/Dictionary.js, line 550

Parameters:

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

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

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(type, values) → {boolean}

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

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(word1) → {Verb}

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

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 Collapse all  |  Expand all

did_initialize_verbs :Boolean

Defined in: adventure/Dictionary.js, line 73

Default value: false

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

Defined in: adventure/Dictionary.js, line 40

Default value: {}

Runtime node: game.dictionary.directionLookup

Lookup table for direction keywords.
directions :Object

Defined in: adventure/Dictionary.js, line 32

Default value: {}

Todos: Is this irrelevant?

Unused?
disabled_verbs :Array

Defined in: adventure/Dictionary.js, line 65

Default value: []

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

Defined in: adventure/Dictionary.js, line 57

Default value: []

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

Defined in: adventure/Dictionary.js, line 25

Default value: {}

A reference back to the main Game object.
if_input_is_empty_print_this :String|Array|function

Defined in: adventure/Dictionary.js, line 89

Default value: "I didn't see any input."

Todos: Move to TBD StringManager where strings can be customized more easily.

if_input_is_empty_print_this can return string or array or function.
if_parser_has_no_response_print_this :String

Defined in: adventure/Dictionary.js, line 97

Default value: "I have no response to your input."

Todos: Move to TBD StringManager where strings can be customized more easily.

if_parser_has_no_response_print_this can return string or array or function.
preverbs :Array

Defined in: adventure/Dictionary.js, line 423

Default value: []

Data for all native verbs are stored as unclassed generic objects aka preverbs. Preverbs are loaded into game.dictionary.preverbs by Dictionary() constructor.
pronouns :Object

Defined in: adventure/Dictionary.js, line 178

Pronoun groups include language for first person, second person, plural, male third person, female third person, nonbinary third person, and nonhuman third person. These can be applied to all of the default response strings built-in to Adventurejs, by setting the person property.
string_lookup :Object

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

Default value: {}

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

Defined in: adventure/Dictionary.js, line 80

Default value: {}

A lookup table for verb keywords.
verb_noun_prep_noun_prep_nouns :Array

Defined in: adventure/Dictionary.js, line 153

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 :Array

Defined in: adventure/Dictionary.js, line 137

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 :Array

Defined in: adventure/Dictionary.js, line 145

Default value: []

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

Defined in: adventure/Dictionary.js, line 105

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 :Array

Defined in: adventure/Dictionary.js, line 169

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 :Array

Defined in: adventure/Dictionary.js, line 161

Default value: []

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

Defined in: adventure/Dictionary.js, line 113

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 :Array

Defined in: adventure/Dictionary.js, line 121

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 :Array

Defined in: adventure/Dictionary.js, line 129

Default value: []

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

Defined in: adventure/Dictionary.js, line 48

Default value: {}

Runtime node: game.dictionary.verbs

Container for all constructed instance of Verb.
Documentation generated by JSDoc 3.6.11 on Mon Nov 20 2023 18:01:34 GMT-0800 (Pacific Standard Time)
Found a problem or error in the docs? Report it to docs@adventurejs.com.