Class:Dictionary
Defined in: adventure/Dictionary.js, line 5
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:
-
gameGame
A reference to the game instance.
- Index
- Methods
- Properties
Index
Methods:
- addPronouns
- combineVerbs
- createVerb
- disableAllVerbsBut
- disableVerbs
- doVerb
- enableVerbs
- getAbbreviation
- getAdjective
- getAdverb
- getDirection
- getObjectivePronoun
- getPossessiveDeterminer
- getPreposition
- getReflexivePronoun
- getStringLookup
- getStringLookupByRange
- getVerb
- hasCommonWord
- hasCommonWord
- inflect
- initStandardVerbs
- isDirection
- isPreposition
- isPronoun
- modifyVerb
- replaceVerb
- set
- set
- setStringLookup
- testVerbSynonyms
Properties:
- abbreviations
- adjectives
- adverbs
- aspects
- body_parts
- common_words
- compound_prepositions
- did_initialize_verbs
- direction_lookup
- directions
- disabled_verbs
- enabled_verbs
- exit_prepositions
- fail_adverbs
- fail_adverbs
- game
- genders
- inflections
- objective_pronouns
- possessive_determiners
- possessive_pronouns
- postures
- prepositions
- pretty_exit_prepositions
- reflexive_pronouns
- string_lookup
- try_gerunds
- try_to_verbs
- verb_gerunds
- verb_lookup
- verb_noun_prep_noun_prep_nouns
- verb_noun_prep_nouns
- verb_noun_prep_prep_nouns
- verb_noun_preps
- verb_prep_noun_prep_noun_prep_nouns
- verb_prep_noun_prep_nouns
- verb_prep_nouns
- verb_prep_prep_nouns
- verb_prep_prep_prep_nouns
- verb_state_lookup
- verbs
Methods Collapse all |
addPronouns
addPronouns(pronouns) → {Object}
Defined in: adventure/dictionary/addPronouns.js, line 8
Parameters:
-
pronounsObject
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:
-
pushVerbsString -
intoVerbString
createVerb
createVerb(preverb) → {object}
Defined in: adventure/dictionary/createVerb.js, line 8
Parameters:
-
preverbobject
A generic object.
Returns:
object
The constructed verb
disableAllVerbsBut
disableAllVerbsBut(enabled_verbs)
Defined in: adventure/dictionary/disableAllVerbsBut.js, line 8
Parameters:
-
enabled_verbsArray
disableVerbs
disableVerbs(disabled_verbs)
Defined in: adventure/dictionary/disableVerbs.js, line 8
Parameters:
-
disabled_verbsString | Array
doVerb
doVerb(verb)
Defined in: adventure/dictionary/doVerb.js, line 8
Parameters:
-
verbString
enableVerbs
enableVerbs(disabled_verbs)
Defined in: adventure/dictionary/enableVerbs.js, line 8
Parameters:
-
disabled_verbsArray | String
getAbbreviation
getAbbreviation(word)
Defined in: adventure/dictionary/getAbbreviation.js, line 8
Parameters:
-
wordString
getAdjective
getAdjective(word) → {String|Boolean}
Defined in: adventure/dictionary/getAdjective.js, line 8
Parameters:
-
wordString
Returns:
String
|
Boolean
getAdverb
getAdverb(word) → {String|Boolean}
Defined in: adventure/dictionary/getAdverb.js, line 8
Parameters:
-
wordString
Returns:
String
|
Boolean
getDirection
getDirection(word) → {String}
Defined in: adventure/dictionary/getDirection.js, line 8
Parameters:
-
wordString
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:
-
wordString
Returns:
String
|
Boolean
getPossessiveDeterminer
getPossessiveDeterminer(word) → {String|Boolean}
Defined in: adventure/dictionary/getPossessiveDeterminer.js, line 8
Parameters:
-
wordString
Returns:
String
|
Boolean
getPreposition
getPreposition(word) → {String|Boolean}
Defined in: adventure/dictionary/getPreposition.js, line 8
Parameters:
-
wordString
Returns:
String
|
Boolean
getReflexivePronoun
getReflexivePronoun(word) → {String|Boolean}
Defined in: adventure/dictionary/getReflexivePronoun.js, line 8
Parameters:
-
wordString
Returns:
String
|
Boolean
getStringLookup
getStringLookup(type, value) → {string}
Defined in: adventure/dictionary/string_lookup.js, line 134
Parameters:
-
typestring
The type to look up, ie "prepositions" or "posture_gerunds". -
valuestring
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:
-
typestring
The type to look up, ie "prepositions" or "posture_gerunds". -
valuestring | 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:
-
verbString
Returns:
object
hasCommonWord
hasCommonWord(word) → {boolean}
Defined in: adventure/dictionary/body_parts.js, line 8
Parameters:
-
wordstring
The word to look up, ie "zoo".
Returns:
boolean
hasCommonWord
hasCommonWord(word) → {boolean}
Defined in: adventure/dictionary/common_words.js, line 8
Parameters:
-
wordstring
The word to look up, ie "zoo".
Returns:
boolean
inflect
inflect(pronoun)
Defined in: adventure/dictionary/inflect.js, line 8
Parameters:
-
pronounString
initStandardVerbs
initStandardVerbs(word) → {String|Boolean}
Defined in: adventure/dictionary/initStandardVerbs.js, line 8
Parameters:
-
wordString
Returns:
String
|
Boolean
isDirection
isDirection(word) → {Boolean}
Defined in: adventure/dictionary/isDirection.js, line 8
Parameters:
-
wordString
A string to be evaluated.
Returns:
Boolean
isPreposition
isPreposition(word) → {String|Boolean}
Defined in: adventure/dictionary/isPreposition.js, line 8
Parameters:
-
wordString
Returns:
String
|
Boolean
isPronoun
isPronoun(word) → {String|Boolean}
Defined in: adventure/dictionary/isPronoun.js, line 8
Parameters:
-
wordString
Returns:
String
|
Boolean
modifyVerb
modifyVerb(modifyVerb) → {object}
Defined in: adventure/dictionary/modifyVerb.js, line 8
Parameters:
-
modifyVerbObject
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:
-
oldVerbString -
newVerbObject
set
set(props) → {adventurejs.Dictionary}
Defined in: adventure/Dictionary.js, line 190
Parameters:
-
propsObject
A generic object containing properties to copy to 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:
-
propsObject
A generic object containing properties to copy to the DisplayObject 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:
-
typestring
The type to set, ie "prepositions" or "posture_gerunds". -
valuesobject
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:
-
word1String
An unclassed verb object.
Properties |
abbreviations
abbreviations :Object
Defined in: adventure/dictionary/abbreviations.js, line 8
adjectives
adjectives :Object
Defined in: adventure/dictionary/adjectives.js, line 8
adverbs
adverbs :Object
Defined in: adventure/dictionary/adverbs.js, line 8
aspects
aspects :Object
Defined in: adventure/dictionary/aspects.js, line 8
body_parts
body_parts :Object
Defined in: adventure/dictionary/body_parts.js, line 20
MyGame.dictionary.set({ body_parts: ["foo", "bar"] });
common_words
common_words :Object
Defined in: adventure/dictionary/common_words.js, line 20
MyGame.dictionary.set({ common_words: ["foo", "bar"] });
compound_prepositions
compound_prepositions :Object
Defined in: adventure/dictionary/compound_prepositions.js, line 8
did_initialize_verbs
did_initialize_verbs :Boolean
Defined in: adventure/Dictionary.js, line 71
Default value: false
direction_lookup
direction_lookup :Object
directions
directions :Object
disabled_verbs
disabled_verbs :Array
Defined in: adventure/Dictionary.js, line 63
Default value: []
enabled_verbs
enabled_verbs :Array
Defined in: adventure/Dictionary.js, line 55
Default value: []
exit_prepositions
exit_prepositions :Object
Defined in: adventure/dictionary/exit_prepositions.js, line 8
fail_adverbs
fail_adverbs :Object
Defined in: adventure/dictionary/fail_adverbs.js, line 8
fail_adverbs
fail_adverbs :Object
Defined in: adventure/dictionary/success_adverbs.js, line 8
game
game :Object
Defined in: adventure/Dictionary.js, line 23
Default value: {}
genders
genders :Object
Defined in: adventure/dictionary/genders.js, line 8
inflections
inflections :Object
Defined in: adventure/dictionary/inflections.js, line 8
objective_pronouns
objective_pronouns :Object
Defined in: adventure/dictionary/objective_pronouns.js, line 8
possessive_determiners
possessive_determiners :Object
Defined in: adventure/dictionary/possessive_determiners.js, line 8
possessive_pronouns
possessive_pronouns :Object
Defined in: adventure/dictionary/possessive_pronouns.js, line 8
postures
postures :Object
Defined in: adventure/dictionary/postures.js, line 8
prepositions
prepositions :Object
Defined in: adventure/dictionary/prepositions.js, line 8
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" }
reflexive_pronouns
reflexive_pronouns :Object
Defined in: adventure/dictionary/reflexive_pronouns.js, line 8
string_lookup
string_lookup :Object
Defined in: adventure/dictionary/string_lookup.js, line 8
Default value: {}
try_gerunds
try_gerunds :Array
Defined in: adventure/Dictionary.js, line 93
Default value: []
try_to_verbs
try_to_verbs :Array
Defined in: adventure/Dictionary.js, line 85
Default value: []
verb_gerunds
verb_gerunds :Array
Defined in: adventure/Dictionary.js, line 101
Default value: []
verb_lookup
verb_lookup :Object
verb_noun_prep_noun_prep_nouns
verb_noun_prep_noun_prep_nouns :Array
Defined in: adventure/Dictionary.js, line 157
Default value: []
verb_noun_prep_nouns
verb_noun_prep_nouns :Array
Defined in: adventure/Dictionary.js, line 141
Default value: []
verb_noun_prep_prep_nouns
verb_noun_prep_prep_nouns :Array
Defined in: adventure/Dictionary.js, line 149
Default value: []
verb_noun_preps
verb_noun_preps :Array
Defined in: adventure/Dictionary.js, line 109
Default value: []
verb_prep_noun_prep_noun_prep_nouns
verb_prep_noun_prep_noun_prep_nouns :Array
Defined in: adventure/Dictionary.js, line 173
Default value: []
verb_prep_noun_prep_nouns
verb_prep_noun_prep_nouns :Array
Defined in: adventure/Dictionary.js, line 165
Default value: []
verb_prep_nouns
verb_prep_nouns :Array
Defined in: adventure/Dictionary.js, line 117
Default value: []
verb_prep_prep_nouns
verb_prep_prep_nouns :Array
Defined in: adventure/Dictionary.js, line 125
Default value: []
verb_prep_prep_prep_nouns
verb_prep_prep_prep_nouns :Array
Defined in: adventure/Dictionary.js, line 133
Default value: []
verb_state_lookup
verb_state_lookup :Object
Defined in: adventure/Dictionary.js, line 181
verbs
verbs :Object
Defined in: adventure/Dictionary.js, line 46
Default value: {}