Pre-release
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

Methods Collapse all  |  Expand all

combineVerbs(pushVerbs, intoVerb)

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

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/createVerb.js, line 9

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

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

Parameters:

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

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

Parameters:

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

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

Parameters:

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

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

Parameters:

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

Defined in: adventure/Dictionary.js, line 223

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 210

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 197

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
getVerb(verb) → {object}

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

Parameters:

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

Returns:

object
initStandardVerbs()

Defined in: adventure/Dictionary.js, line 169

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 184

Parameters:

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

Returns:

Boolean
patchVerb(patchVerb)

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

Parameters:

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

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

Parameters:

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

Defined in: adventure/Dictionary.js, line 236

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

adjectives :Object

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

Adjectives recognized by the parser.
adverbs :Object

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

Adverbs are currently unused but may be supported in future.
aspects :Object

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

Prepositions that are recognized as tangible aspects.
compound_prepositions :Object

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

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

Defined in: adventure/Dictionary.js, line 72

Default value: false

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

Defined in: adventure/Dictionary.js, line 39

Default value: {}

Runtime node: game.dictionary.directionLookup

Lookup table for direction keywords.
directions :Object

Defined in: adventure/Dictionary.js, line 31

Default value: {}

Todos: Is this irrelevant?

Unused?
disabled_verbs :Array

Defined in: adventure/Dictionary.js, line 64

Default value: []

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

Defined in: adventure/Dictionary.js, line 56

Default value: []

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

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

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

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

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

Defined in: adventure/success_adverbs.js, line 9

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

Defined in: adventure/Dictionary.js, line 24

Default value: {}

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

Defined in: adventure/Settings.js, line 219

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

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

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

Postures that can be applied to Characters.
prepositions :Object

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

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

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

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

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

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 79

Default value: {}

A lookup table for verb keywords.
verb_noun_prep_noun_prep_nouns :Array

Defined in: adventure/Dictionary.js, line 136

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 120

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 128

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 88

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 152

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 144

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 96

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 104

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 112

Default value: []

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

Defined in: adventure/Dictionary.js, line 160

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

Defined in: adventure/Dictionary.js, line 47

Default value: {}

Runtime node: game.dictionary.verbs

Container for all constructed instance of Verb.