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

addPronouns
addPronouns(pronouns) → {Object}

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

Parameters:

  • pronouns Object
A method to allow authors to add custom pronouns.

Example:

MyGame.dictionary.addPronouns({
  gender: "aile",
  singular: true,
  subjective_pronoun: "ai",
  objective_pronoun: "ain",
  possessive_determiner: "aire",
  possessive_pronoun: "aires",
  reflexive_pronoun: "aiself",
});

Returns:

Object
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) → {object}

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:

object 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.
getAbbreviation
getAbbreviation(word)

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

Framework class

Parameters:

  • word String
Check if specified word is listed in dictionary.abbreviations.
getAdjective
getAdjective(word) → {String|Boolean}

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

Parameters:

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

Returns:

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

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

Parameters:

  • word 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.
getObjectivePronoun
getObjectivePronoun(word) → {String|Boolean}

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

Parameters:

  • word String
Check if specified word is listed in dictionary.pronouns.

Returns:

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

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

Parameters:

  • word String
Determine whether string is recognized as a possessive pronoun and return the string.

Returns:

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

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

Parameters:

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

Returns:

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

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

Parameters:

  • word String
Check if specified word is listed in dictionary.reflexive_pronouns.

Returns:

String | Boolean
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/body_parts.js, line 8

Parameters:

  • word string
    The word to look up, ie "zoo".
Ask whether the body parts lookup contains the specified word.

Returns:

boolean
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 lookup contains the specified word.

Returns:

boolean
inflect
inflect(pronoun)

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

Framework class

Parameters:

  • pronoun String
Takes a plural pronoun token ("we", "we're", etc) and converts to the equivalent pronoun according to game.settings.prounouns, unless another set of pronouns is provided.
initStandardVerbs
initStandardVerbs(word) → {String|Boolean}

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

Parameters:

  • word String
Construct all native verbs. When complete, sets game.dictionary.did_initialize_verbs to true.

Returns:

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

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

Parameters:

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

Returns:

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

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

Parameters:

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

Returns:

String | Boolean
modifyVerb
modifyVerb(modifyVerb) → {object}

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

Parameters:

  • modifyVerb Object
modifyVerb enables an author to revise the properties of an existing verb. For example, let's say you want to revise the verb "plug" so that it works in the dark - meaning that players it can operate on assets the player can't see. You might copy the plug.phrase1 and in your game file, call modifyVerb with line visible: true removed. Use game.modifyVerb() as a shortcut.
MyGame.modifyVerb({
  name: "plug",
  phrase1:{
    accepts_noun: true,
    requires_noun: true,
    accepts_preposition: true,
    noun_must_be:
    {
      known: true,
      tangible: true,
      present: true,
      visible: true,
      reachable: true,
    },
  },
});

Returns:

object
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 190

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  | 

abbreviations
abbreviations :Object

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

A list of common abbreviations that have periods in them.
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.
body_parts
body_parts :Object

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

Body parts is a group of words that may not exist in the game, but which a player could reasonably be expected to use in relation to a character, 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({ body_parts: ["foo", "bar"] });
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.
genders
genders :Object

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

Genders recognized by the parser.
inflections
inflections :Object

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

We use the pronouns for first person plural as a lookup key to inflect for other cases. Inflection 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.
objective_pronouns
objective_pronouns :Object

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

These objective pronouns are recognized by the parser.
possessive_determiners
possessive_determiners :Object

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

These possessives determiners are recognized by the parser.
possessive_pronouns
possessive_pronouns :Object

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

These possessives pronouns are recognized by the parser.
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

Default value: { behind: "out from behind", in: "out of", on: "off of", under: "out from under", over: "down from over", between: "out from between", beside: "from beside", across: "from across", attached: "from where it's attached to", through: "from" }

Pretty exit prepositions are used to describe the action of leaving a nested position.
reflexive_pronouns
reflexive_pronouns :Object

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

These reflexive pronouns are recognized by the parser.
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.
try_gerunds
try_gerunds :Array

Defined in: adventure/Dictionary.js, line 93

Default value: []

We store a variety of phrasal verb patterns, which we compare against when searching player input.
try_to_verbs
try_to_verbs :Array

Defined in: adventure/Dictionary.js, line 85

Default value: []

We store a variety of phrasal verb patterns, which we compare against when searching player input.
verb_gerunds
verb_gerunds :Array

Defined in: adventure/Dictionary.js, line 101

Default value: []

We store a variety of phrasal verb patterns, which we compare against when searching player input.
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 157

Default value: []

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

Defined in: adventure/Dictionary.js, line 141

Default value: []

We store a variety of phrasal verb patterns, 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 149

Default value: []

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

Defined in: adventure/Dictionary.js, line 109

Default value: []

We store a variety of phrasal verb patterns, 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 173

Default value: []

We store a variety of phrasal verb patterns, 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 165

Default value: []

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

Defined in: adventure/Dictionary.js, line 117

Default value: []

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

Defined in: adventure/Dictionary.js, line 125

Default value: []

We store a variety of phrasal verb patterns, 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 133

Default value: []

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

Defined in: adventure/Dictionary.js, line 181

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.