Class:Dictionary
Defined in: adventure/Dictionary.js, line 5
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.
- Index
- Methods
- Properties
Index
Methods:
- combineVerbs
- createVerb
- disableAllVerbsBut
- disableVerbs
- doVerb
- enableVerbs
- getAdjective
- getAdverb
- getDirection
- getPreposition
- getPronoun
- getStringLookup
- getStringLookupByRange
- getVerb
- initStandardVerbs
- isDirection
- isPreposition
- patchVerb
- replaceVerb
- set
- set
- setStringLookup
- testVerbSynonyms
Properties:
- adjectives
- adverbs
- aspects
- compound_prepositions
- did_initialize_verbs
- direction_lookup
- directions
- disabled_verbs
- enabled_verbs
- exit_prepositions
- fail_adverbs
- fail_adverbs
- game
- if_input_is_empty_print_this
- 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(pushVerbs, intoVerb)
Defined in: adventure/dictionary/combineVerbs.js, line 8
Parameters:
-
pushVerbs
String -
intoVerb
String
createVerb(preverb) → {Verb}
Defined in: adventure/dictionary/createVerb.js, line 8
Parameters:
-
preverb
object
A generic object.
disableAllVerbsBut(enabled_verbs)
Defined in: adventure/dictionary/disableAllVerbsBut.js, line 8
Parameters:
-
enabled_verbs
Array
disableVerbs(disabled_verbs)
Defined in: adventure/dictionary/disableVerbs.js, line 8
Parameters:
-
disabled_verbs
String | Array
doVerb(verb)
Defined in: adventure/dictionary/doVerb.js, line 8
Parameters:
-
verb
String
enableVerbs(disabled_verbs)
Defined in: adventure/dictionary/enableVerbs.js, line 8
Parameters:
-
disabled_verbs
Array | String
getAdjective(preposition) → {String|Boolean}
Defined in: adventure/Dictionary.js, line 222
Parameters:
-
preposition
String
Returns:
String
|
Boolean
getAdverb(preposition) → {String|Boolean}
Defined in: adventure/Dictionary.js, line 209
Parameters:
-
preposition
String
Returns:
String
|
Boolean
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.
getPreposition(preposition) → {String|Boolean}
Defined in: adventure/Dictionary.js, line 196
Parameters:
-
preposition
String
Returns:
String
|
Boolean
getPronoun(pronoun)
Defined in: adventure/dictionary/getPronoun.js, line 8
Parameters:
-
pronoun
String
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(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(verb) → {object}
Defined in: adventure/dictionary/getVerb.js, line 8
Parameters:
-
verb
String
Returns:
object
initStandardVerbs()
Defined in: adventure/Dictionary.js, line 168
isDirection(word) → {Boolean}
Defined in: adventure/dictionary/isDirection.js, line 8
Parameters:
-
word
String
A string to be evaluated.
Returns:
Boolean
isPreposition(preposition) → {Boolean}
Defined in: adventure/Dictionary.js, line 183
Parameters:
-
preposition
String
Returns:
Boolean
patchVerb(patchVerb)
Defined in: adventure/dictionary/patchVerb.js, line 8
Parameters:
-
patchVerb
Object
replaceVerb(oldVerb, newVerb)
Defined in: adventure/dictionary/replaceVerb.js, line 8
Parameters:
-
oldVerb
String -
newVerb
Object
set(props) → {adventurejs.Dictionary}
Defined in: adventure/Dictionary.js, line 235
Parameters:
-
props
Object
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(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.
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 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(word1) → {Verb}
Defined in: adventure/dictionary/testVerbSynonyms.js, line 8
Parameters:
-
word1
String
An unclassed verb object.
Properties |
adjectives :Object
Defined in: adventure/dictionary/adjectives.js, line 8
adverbs :Object
Defined in: adventure/dictionary/adverbs.js, line 8
aspects :Object
Defined in: adventure/dictionary/aspects.js, line 8
compound_prepositions :Object
Defined in: adventure/dictionary/compound_prepositions.js, line 8
did_initialize_verbs :Boolean
Defined in: adventure/Dictionary.js, line 71
Default value: false
direction_lookup :Object
directions :Object
disabled_verbs :Array
Defined in: adventure/Dictionary.js, line 63
Default value: []
enabled_verbs :Array
Defined in: adventure/Dictionary.js, line 55
Default value: []
exit_prepositions :Object
Defined in: adventure/dictionary/exit_prepositions.js, line 8
fail_adverbs :Object
Defined in: adventure/dictionary/fail_adverbs.js, line 8
fail_adverbs :Object
Defined in: adventure/dictionary/success_adverbs.js, line 8
game :Object
Defined in: adventure/Dictionary.js, line 23
Default value: {}
if_input_is_empty_print_this :String|Array|function
Defined in: adventure/Settings.js, line 219
Default value: "I didn't see any input."
postures :Object
Defined in: adventure/dictionary/postures.js, line 8
prepositions :Object
Defined in: adventure/dictionary/prepositions.js, line 8
pretty_exit_prepositions :Object
Defined in: adventure/dictionary/pretty_exit_prepositions.js, line 8
pronouns :Object
Defined in: adventure/dictionary/pronouns.js, line 8
string_lookup :Object
Defined in: adventure/dictionary/string_lookup.js, line 8
Default value: {}
verb_lookup :Object
verb_noun_prep_noun_prep_nouns :Array
Defined in: adventure/Dictionary.js, line 135
Default value: []
verb_noun_prep_nouns :Array
Defined in: adventure/Dictionary.js, line 119
Default value: []
verb_noun_prep_prep_nouns :Array
Defined in: adventure/Dictionary.js, line 127
Default value: []
verb_noun_preps :Array
Defined in: adventure/Dictionary.js, line 87
Default value: []
verb_prep_noun_prep_noun_prep_nouns :Array
Defined in: adventure/Dictionary.js, line 151
Default value: []
verb_prep_noun_prep_nouns :Array
Defined in: adventure/Dictionary.js, line 143
Default value: []
verb_prep_nouns :Array
Defined in: adventure/Dictionary.js, line 95
Default value: []
verb_prep_prep_nouns :Array
Defined in: adventure/Dictionary.js, line 103
Default value: []
verb_prep_prep_prep_nouns :Array
Defined in: adventure/Dictionary.js, line 111
Default value: []
verb_state_lookup :Object
Defined in: adventure/Dictionary.js, line 159
verbs :Object
Defined in: adventure/Dictionary.js, line 46
Default value: {}