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:
- combineVerbs
- createVerb
- disableAllVerbsBut
- disableVerbs
- doVerb
- enableVerbs
- getAdjective
- getAdverb
- getDirection
- getPreposition
- getPronoun
- getStringLookup
- getStringLookupByRange
- getVerb
- hasCommonWord
- initStandardVerbs
- isDirection
- isPreposition
- patchVerb
- replaceVerb
- set
- set
- setStringLookup
- testVerbSynonyms
Properties:
- adjectives
- adverbs
- aspects
- common_words
- compound_prepositions
- did_initialize_verbs
- direction_lookup
- directions
- disabled_verbs
- enabled_verbs
- exit_prepositions
- fail_adverbs
- fail_adverbs
- game
- postures
- prepositions
- pretty_exit_prepositions
- pronouns
- string_lookup
- 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 |
combineVerbs
combineVerbs(pushVerbs, intoVerb)
Defined in: adventure/dictionary/combineVerbs.js, line 8
Parameters:
-
pushVerbsString -
intoVerbString
createVerb
createVerb(preverb) → {Verb}
Defined in: adventure/dictionary/createVerb.js, line 8
Parameters:
-
preverbobject
A generic object.
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
getAdjective
getAdjective(preposition) → {String|Boolean}
Defined in: adventure/Dictionary.js, line 238
Parameters:
-
prepositionString
Returns:
String
|
Boolean
getAdverb
getAdverb(preposition) → {String|Boolean}
Defined in: adventure/Dictionary.js, line 209
Parameters:
-
prepositionString
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.
getPreposition
getPreposition(preposition) → {String|Boolean}
Defined in: adventure/Dictionary.js, line 196
Parameters:
-
prepositionString
Returns:
String
|
Boolean
getPronoun
getPronoun(pronoun)
Defined in: adventure/dictionary/getPronoun.js, line 8
Parameters:
-
pronounString
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/common_words.js, line 8
Parameters:
-
wordstring
The word to look up, ie "zoo".
Returns:
boolean
initStandardVerbs
initStandardVerbs()
Defined in: adventure/Dictionary.js, line 168
isDirection
isDirection(word) → {Boolean}
Defined in: adventure/dictionary/isDirection.js, line 8
Parameters:
-
wordString
A string to be evaluated.
Returns:
Boolean
isPreposition
isPreposition(preposition) → {Boolean}
Defined in: adventure/Dictionary.js, line 183
Parameters:
-
prepositionString
Returns:
Boolean
patchVerb
patchVerb(patchVerb) → {object}
Defined in: adventure/dictionary/patchVerb.js, line 8
Parameters:
-
patchVerbObject
plug.phrase1 and in your game file, call patchVerb with
line visible: true removed. Use game.patchVerb() as a shortcut.
MyGame.patchVerb({
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 251
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 |
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
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: {}
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" }
pronouns
pronouns :Object
Defined in: adventure/dictionary/pronouns.js, line 8
string_lookup
string_lookup :Object
Defined in: adventure/dictionary/string_lookup.js, line 8
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 135
Default value: []
verb_noun_prep_nouns
verb_noun_prep_nouns :Array
Defined in: adventure/Dictionary.js, line 119
Default value: []
verb_noun_prep_prep_nouns
verb_noun_prep_prep_nouns :Array
Defined in: adventure/Dictionary.js, line 127
Default value: []
verb_noun_preps
verb_noun_preps :Array
Defined in: adventure/Dictionary.js, line 87
Default value: []
verb_prep_noun_prep_noun_prep_nouns
verb_prep_noun_prep_noun_prep_nouns :Array
Defined in: adventure/Dictionary.js, line 151
Default value: []
verb_prep_noun_prep_nouns
verb_prep_noun_prep_nouns :Array
Defined in: adventure/Dictionary.js, line 143
Default value: []
verb_prep_nouns
verb_prep_nouns :Array
Defined in: adventure/Dictionary.js, line 95
Default value: []
verb_prep_prep_nouns
verb_prep_prep_nouns :Array
Defined in: adventure/Dictionary.js, line 103
Default value: []
verb_prep_prep_prep_nouns
verb_prep_prep_prep_nouns :Array
Defined in: adventure/Dictionary.js, line 111
Default value: []
verb_state_lookup
verb_state_lookup :Object
Defined in: adventure/Dictionary.js, line 159
verbs
verbs :Object
Defined in: adventure/Dictionary.js, line 46
Default value: {}