Class: Dictionary
Defined in: adventure/Dictionary.js, line 6
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
- directionLookup
- 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 9
Parameters:
-
pushVerbs
String -
intoVerb
String
createVerb(preverb) → {Verb}
Defined in: adventure/dictionary/createVerb.js, line 9
Parameters:
-
preverb
object
A generic object.
disableAllVerbsBut(enabled_verbs)
Defined in: adventure/dictionary/disableAllVerbsBut.js, line 9
Parameters:
-
enabled_verbs
Array
disableVerbs(disabled_verbs)
Defined in: adventure/dictionary/disableVerbs.js, line 9
Parameters:
-
disabled_verbs
String | Array
doVerb(verb)
Defined in: adventure/dictionary/doVerb.js, line 9
Parameters:
-
verb
String
enableVerbs(disabled_verbs)
Defined in: adventure/dictionary/enableVerbs.js, line 9
Parameters:
-
disabled_verbs
Array | String
getAdjective(preposition) → {String|Boolean}
Defined in: adventure/Dictionary.js, line 223
Parameters:
-
preposition
String
Returns:
String
|
Boolean
getAdverb(preposition) → {String|Boolean}
Defined in: adventure/Dictionary.js, line 210
Parameters:
-
preposition
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
Returns:
String
|
Boolean
getPronoun(pronoun)
Defined in: adventure/dictionary/getPronoun.js, line 9
Parameters:
-
pronoun
String
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
Returns:
object
initStandardVerbs()
Defined in: adventure/Dictionary.js, line 169
isDirection(word) → {Boolean}
Defined in: adventure/dictionary/isDirection.js, line 9
Parameters:
-
word
String
A string to be evaluated.
Returns:
Boolean
isPreposition(preposition) → {Boolean}
Defined in: adventure/Dictionary.js, line 184
Parameters:
-
preposition
String
Returns:
Boolean
patchVerb(patchVerb)
Defined in: adventure/dictionary/patchVerb.js, line 9
Parameters:
-
patchVerb
Object
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.
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.
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.
Properties |
adjectives :Object
Defined in: adventure/dictionary/adjectives.js, line 9
adverbs :Object
Defined in: adventure/dictionary/adverbs.js, line 9
aspects :Object
Defined in: adventure/dictionary/aspects.js, line 9
compound_prepositions :Object
Defined in: adventure/dictionary/compound_prepositions.js, line 9
did_initialize_verbs :Boolean
Defined in: adventure/Dictionary.js, line 72
Default value: false
directionLookup :Object
directions :Object
disabled_verbs :Array
Defined in: adventure/Dictionary.js, line 64
Default value: []
enabled_verbs :Array
Defined in: adventure/Dictionary.js, line 56
Default value: []
exit_prepositions :Object
Defined in: adventure/dictionary/exit_prepositions.js, line 9
fail_adverbs :Object
Defined in: adventure/dictionary/fail_adverbs.js, line 9
fail_adverbs :Object
Defined in: adventure/success_adverbs.js, line 9
game :Object
Defined in: adventure/Dictionary.js, line 24
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 9
prepositions :Object
Defined in: adventure/dictionary/prepositions.js, line 9
pretty_exit_prepositions :Object
Defined in: adventure/dictionary/pretty_exit_prepositions.js, line 9
pronouns :Object
Defined in: adventure/dictionary/pronouns.js, line 9
string_lookup :Object
Defined in: adventure/dictionary/string_lookup.js, line 9
Default value: {}
verb_lookup :Object
verb_noun_prep_noun_prep_nouns :Array
Defined in: adventure/Dictionary.js, line 136
Default value: []
verb_noun_prep_nouns :Array
Defined in: adventure/Dictionary.js, line 120
Default value: []
verb_noun_prep_prep_nouns :Array
Defined in: adventure/Dictionary.js, line 128
Default value: []
verb_noun_preps :Array
Defined in: adventure/Dictionary.js, line 88
Default value: []
verb_prep_noun_prep_noun_prep_nouns :Array
Defined in: adventure/Dictionary.js, line 152
Default value: []
verb_prep_noun_prep_nouns :Array
Defined in: adventure/Dictionary.js, line 144
Default value: []
verb_prep_nouns :Array
Defined in: adventure/Dictionary.js, line 96
Default value: []
verb_prep_prep_nouns :Array
Defined in: adventure/Dictionary.js, line 104
Default value: []
verb_prep_prep_prep_nouns :Array
Defined in: adventure/Dictionary.js, line 112
Default value: []
verb_state_lookup :Object
Defined in: adventure/Dictionary.js, line 160
verbs :Object
Defined in: adventure/Dictionary.js, line 47
Default value: {}