Class:Settings
Defined in: adventure/Settings.js, line 5
Description
Settings is a repository for global Game options. Settings is created automatically by Game. This is an internal class that authors should not need to construct. However, authors can set options from their game file as shown below, or change them during runtime with calls to MyGame.settings.set().
Example:
var MyGame = new adventurejs.Game( "MyGame", "GameDisplay" );
MyGame.settings.set({
max_undos: 20,
show_room_names_in_exit_descriptions: false,
can_auto_open_apertures: false
});
Private Constructor:
var foo = new adventurejs.Settings(game)
Parameters:
-
game
Game
A reference to the game instance.
- Index
- Methods
- Properties
Index
Methods:
Properties:
- ambient_temperature
- apply_color_classes_to_drawn_things
- apply_color_classes_to_written_strings
- asset_list_format
- auto_mount_vehicles
- auto_open_containers
- auto_open_containers_after_first_use
- auto_pick_inferred_container
- auto_pick_inferred_objects
- auto_stand_on_travel
- auto_take_assets
- auto_take_assets_after_first_use
- auto_unnest_on_travel
- concatenate_descriptions
- debug_keywords
- disambiguation_considers_last_turn
- enable_events
- goto_excludes_locked_doors
- goto_excludes_unvisited_locations
- goto_prints_room_descriptions
- handful
- if_input_is_an_asset_name_examine_it
- if_input_is_empty_print_room_description
- if_parser_has_no_response_print_this
- if_room_is_dark_print_this
- if_verb_is_unknown_print_this
- if_word_is_common_print_this
- if_word_is_unknown_print_this
- infer_containers
- infer_containers_prefers_reservoir
- infer_objects
- known_by_all_players
- log_keywords
- log_level
- log_trace_level
- max_level_of_modified_descriptions_to_stack
- max_undos
- mouthful
- name_for_dark_rooms
- obfuscate_saves
- objects_must_be_used_before_inferring
- on_floor_blocks_travel
- person
- print_inferred
- print_room_contents
- print_room_exits
- print_verbose_room_descriptions_on_first_visit
- pronouns
- quiet
- randomize_arrays_in_getStringOrArrayOrFunction
- randomize_arrays_in_getStringOrArrayOrFunction
- respect_quiet
- seen_by_all_players
- show_compass_rose_in_status
- show_disambiguation_as_ordered_list
- show_room_names_in_exit_descriptions
- show_room_names_in_exit_descriptions_only_after_exit_has_been_used
- show_room_names_in_exit_descriptions_only_when_room_is_known
- states
- use_nested_verb_phase_hooks
- when_travel_fails_list_exits
- xz_determines_reachability
- xz_determines_reachability
Methods Collapse all |
getCommonWordMessage
getCommonWordMessage(word) → {string}
Defined in: adventure/Settings.js, line 1084
Parameters:
-
word
string
The unknown word.
Returns:
string
getUnknownVerbMessage
getUnknownVerbMessage(word) → {string}
Defined in: adventure/Settings.js, line 1054
Parameters:
-
word
string
The unknown verb.
Returns:
string
getUnknownWordMessage
getUnknownWordMessage(word) → {string}
Defined in: adventure/Settings.js, line 1069
Parameters:
-
word
string
The unknown word.
Returns:
string
getUnparsedMessage
getUnparsedMessage()
Defined in: adventure/Settings.js, line 1036
set
set(props) → {adventurejs.Settings}
Defined in: adventure/Settings.js, line 1024
Parameters:
-
props
Object
A generic object containing properties to copy to the instance.
Returns:
adventurejs.Settings
Returns the instance the method is called on (useful for chaining calls.)
Properties |
ambient_temperature
ambient_temperature :Number
Defined in: adventure/Settings.js, line 538
Default value: 20
Todos: celsius/farenheit conversion
apply_color_classes_to_drawn_things
apply_color_classes_to_drawn_things :Boolean
Defined in: adventure/Settings.js, line 1013
Default value: true
apply_color_classes_to_written_strings
apply_color_classes_to_written_strings :Boolean
Defined in: adventure/Settings.js, line 1003
Default value: true
asset_list_format
asset_list_format :String
Defined in: adventure/Settings.js, line 344
asset_list_format
to customize
printed lists of assets, such as:
"On the bed you see a pillow, a blanket, and a stuffed bear."
Use these custom templates to represent dynamic content.
- Use {preposition} for the aspect
- Use {name} for the asset name (including articles)
- Use {we} for dynamic pronoun (or not, if you have a fixed pronoun)
- Use {list} for the dynamic asset list
- Use {is} to stand in for is/are depending on the number of list items
var MyGame = new adventurejs.Game( "MyGame", "GameDisplay" );
MyGame.settings.set({
asset_list_format: `{Preposition} {name} {we} see {list}. `
asset_list_format: `{Preposition} {name} {is} {list}. `
asset_list_format: `{List} {is} {preposition} {name}. `
asset_list_format: `{We} see {list} {preposition} {name}. `
});
auto_mount_vehicles
auto_mount_vehicles :Boolean
Defined in: adventure/Settings.js, line 741
Default value: false
auto_open_containers
auto_open_containers :Boolean
Defined in: adventure/Settings.js, line 493
Default value: true
auto_open_containers_after_first_use
auto_open_containers_after_first_use :Boolean
Defined in: adventure/Settings.js, line 503
Default value: true
auto_pick_inferred_container
auto_pick_inferred_container :Boolean
Defined in: adventure/Settings.js, line 665
Default value: true
infer_containers
results in multiple assets, automatically pick one.
Otherwise prompt player to select one.
auto_pick_inferred_objects
auto_pick_inferred_objects :Boolean
Defined in: adventure/Settings.js, line 707
Default value: true
infer_objects
results in multiple assets, the first found asset will be used
Otherwise prompt player to select one.
auto_stand_on_travel
auto_stand_on_travel :Boolean
Defined in: adventure/Settings.js, line 724
Default value: false
auto_take_assets
auto_take_assets :Boolean
Defined in: adventure/Settings.js, line 474
Default value: true
auto_take_assets_after_first_use
auto_take_assets_after_first_use :Boolean
Defined in: adventure/Settings.js, line 483
Default value: true
auto_unnest_on_travel
auto_unnest_on_travel :Boolean
Defined in: adventure/Settings.js, line 716
Default value: false
concatenate_descriptions
concatenate_descriptions :Boolean
Defined in: adventure/Settings.js, line 812
Default value: false
look
or examine
, the game
looks for a base description for the specified asset, and also looks
for any modified descriptions, such as looking with a special light
or through a lens or from a particular location. If a modified description
is found, depending on how you write descriptions, you may want the
modified description appended to the base description, or you may want the
modified description to completely replace the base description. This is
purely a matter of stylistic preference. See the examples below to learn
more about the distinction.
Example:
Consider this chalice: it has a base description for "look" and a modified description for "look with occult candle", and it makes sense that we might want to print both.var MyGame = new adventurejs.Game( "MyGame", "GameDisplay" );
MyGame.createAsset({
class: "Chalice",
name: "chalice",
place: { in: "Treasure Room" },
descriptions: {
look: {
default: "The chalice is baked from rough clay. ",
"with occult candle":
"The light of the candle reveals glowing runes inscribed in the clay. ",
},
},
});
Now consider this sword. It's set up the same way, but it's written such that
we want the modified description to replace the base description entirely.
var MyGame = new adventurejs.Game( "MyGame", "GameDisplay" );
MyGame.createAsset({
class: "Chalice",
name: "chalice",
place: { in: "Treasure Room" },
descriptions: {
look: {
default: "It's an unremarkable steel sword. ",
"with occult candle":
"Seen beneath the light of the occult candle, the sword dances with eldritch flames. ",
},
},
});
debug_keywords
debug_keywords :Object
Defined in: adventure/Settings.js, line 132
verbaction
, verbreaction
, and
verbphase
each represent types of hooks that
authors can use to inject custom code. Enabling these will
show you what hooks fire during a turn.
disambiguation_considers_last_turn
disambiguation_considers_last_turn :Boolean
Defined in: adventure/Settings.js, line 861
Default value: true
enable_events
enable_events :Boolean
Defined in: adventure/Settings.js, line 624
Default value: true
goto_excludes_locked_doors
goto_excludes_locked_doors :Boolean
Defined in: adventure/Settings.js, line 928
Default value: false
goto_excludes_unvisited_locations
goto_excludes_unvisited_locations :Boolean
Defined in: adventure/Settings.js, line 939
Default value: true
goto_prints_room_descriptions
goto_prints_room_descriptions :Boolean
Defined in: adventure/Settings.js, line 947
Default value: true
handful
handful :Number
Defined in: adventure/Settings.js, line 525
Default value: 100
if_input_is_an_asset_name_examine_it
if_input_is_an_asset_name_examine_it :Boolean
Defined in: adventure/Settings.js, line 421
Default value: true
if_input_is_empty_print_room_description
if_input_is_empty_print_room_description :Boolean
Defined in: adventure/Settings.js, line 301
Default value: false
if_parser_has_no_response_print_this
if_parser_has_no_response_print_this :Boolean
Defined in: adventure/Settings.js, line 316
MyGame.settings.set({
if_parser_has_no_response_print_this: "I didn't understand {input}. ",
});
This example wraps the player's input in an <em> element so that
it can be styled differently from the rest of the output. This
isn't required and you can omit the <em> if you prefer.
And in fact you don't even need to include the original input
if you prefer not to. Just omit {input}
from your
string and the string will be printed as you set it.
if_parser_has_no_response_print_this
supports the use of
getStringOrArrayOrFunction
meaning that you can vary it up if you like by setting it to
a rotating array of strings or a contextually aware function.
if_room_is_dark_print_this
if_room_is_dark_print_this :Boolean
Defined in: adventure/Settings.js, line 409
if_verb_is_unknown_print_this
if_verb_is_unknown_print_this :Boolean
Defined in: adventure/Settings.js, line 396
if_verb_is_unknown_print_this
supports the use of
getStringOrArrayOrFunction
meaning that you can vary it up if you like by setting it to
a rotating array of strings or a contextually aware function.
if_word_is_common_print_this
if_word_is_common_print_this :Boolean
Defined in: adventure/Settings.js, line 369
if_word_is_common_print_this
supports the use of
getStringOrArrayOrFunction
meaning that you can vary it up if you like by setting it to
a rotating array of strings or a contextually aware function.
if_word_is_unknown_print_this
if_word_is_unknown_print_this :Boolean
Defined in: adventure/Settings.js, line 383
if_word_is_unknown_print_this
supports the use of
getStringOrArrayOrFunction
meaning that you can vary it up if you like by setting it to
a rotating array of strings or a contextually aware function.
infer_containers
infer_containers :Boolean
Defined in: adventure/Settings.js, line 633
Default value: true
infer_containers_prefers_reservoir
infer_containers_prefers_reservoir :Boolean
Defined in: adventure/Settings.js, line 648
Default value: true
infer_containers_prefers_reservoir
is true, the verb throw
's logic will
make that assumption, rather than prompting player
to specify an indirect object.
infer_objects
infer_objects :Boolean
Defined in: adventure/Settings.js, line 674
Default value: true
known_by_all_players
known_by_all_players :Boolean
Defined in: adventure/Settings.js, line 882
Default value: true
log_keywords
log_keywords :Object
Defined in: adventure/Settings.js, line 67
Set log_keywords.all to true to log all keywords.
this.log_keywords = {
- all: false,
- character: false,
- copyoperations: false ,
- debug: false,
- dictionary: false,
- display: false,
- exit: false,
- game: false,
- parser: false,
- print: false,
- room: false,
- saverestore: false,
- substanceemitter: false,
- substancemixer: false,
- tangible: false,
- travel: false,
- tutorial: false,
- utility: false,
- verb: false,
- verbaction: false,
- verbreaction: false,
- verbphase: false,
- vessel: false,
- warning: false,
log_level
log_level :Number
Defined in: adventure/Settings.js, line 44
Default value: 1
log_trace_level
log_trace_level :Number
Defined in: adventure/Settings.js, line 56
Default value: 0
max_level_of_modified_descriptions_to_stack
max_level_of_modified_descriptions_to_stack :int
Defined in: adventure/Settings.js, line 959
Default value: 1
For example, let's say that "through x-ray specs" and "with black light" are two separate modifiers. If max_level_of_modified_descriptions_to_stack is 0, only the first one found will be printed. If max_level_of_modified_descriptions_to_stack is 1, both descriptions will be printed.
On the other hand, let's say the author has set "through x-ray specs, with black light" as a third option. It's one combined modifier with two clauses, that is only satisfied if both conditions are tru. If max_level_of_modified_descriptions_to_stack is 0 or 1, only the combined description will be printed. If max_level_of_modified_descriptions_to_stack were set to 2 or higher, the description for "through x-ray specs, with black light" would print, as would any other double claused descriptions whose conditions were met.
See Description Modifiers and Advanced Descriptions for more info.
max_undos
max_undos :Number
Defined in: adventure/Settings.js, line 35
Default value: 10
mouthful
mouthful :Number
Defined in: adventure/Settings.js, line 514
Default value: 100
name_for_dark_rooms
name_for_dark_rooms :Boolean
Defined in: adventure/Settings.js, line 415
obfuscate_saves
obfuscate_saves :Boolean
Defined in: adventure/Settings.js, line 920
Default value: false
objects_must_be_used_before_inferring
objects_must_be_used_before_inferring :Boolean
Defined in: adventure/Settings.js, line 691
Default value: false
infer_objects
will
only be applied once a player has already interacted
with the direct object. This pattern is intended to
prevent giving away puzzle solutions. For example,
perhaps there are many keys but only one that opens
a certain lock, and determining which key opens the
lock is part of a puzzle. If this is set to true,
it would prevent players from being able to unlock
the door without trying all the keys to find the
correct one.
on_floor_blocks_travel
on_floor_blocks_travel :Boolean
Defined in: adventure/Settings.js, line 733
Default value: false
person
person :String
Defined in: adventure/Settings.js, line 571
person
setting allows you to change
the pronouns in all of the default response strings
built-in to AdventureJS. For instance, if take
has a response that says You pick up the axe.
you can change the word You to I in this and all other
responses by setting person from seconds to first.
print_inferred
print_inferred :Boolean
Defined in: adventure/Settings.js, line 874
Default value: true
print_room_contents
print_room_contents :String
Defined in: adventure/Settings.js, line 604
print_room_contents
is true, a list of
room contents will be appended to room descriptions.
print_room_exits
print_room_exits :String
Defined in: adventure/Settings.js, line 597
print_room_exits
is true, a list of
exits will be appended to room descriptions.
print_verbose_room_descriptions_on_first_visit
print_verbose_room_descriptions_on_first_visit :String
Defined in: adventure/Settings.js, line 617
pronouns
pronouns :Object
Defined in: adventure/Settings.js, line 556
pronouns
setting is a lookup table
for use with person
.
quiet
quiet :Boolean
Defined in: adventure/Settings.js, line 900
Default value: false
randomize_arrays_in_getStringOrArrayOrFunction
randomize_arrays_in_getStringOrArrayOrFunction :Boolean
Defined in: adventure/Settings.js, line 430
Default value: false
Todos: List properties that this applies to.
For more information, see How to Use String|Array|Function
randomize_arrays_in_getStringOrArrayOrFunction
randomize_arrays_in_getStringOrArrayOrFunction :Boolean
Defined in: adventure/Settings.js, line 452
Default value: true
Todos: List properties that this applies to.
For more information, see How to Use String|Array|Function
respect_quiet
respect_quiet :Boolean
Defined in: adventure/Settings.js, line 911
Default value: true
seen_by_all_players
seen_by_all_players :Boolean
Defined in: adventure/Settings.js, line 891
Default value: true
show_compass_rose_in_status
show_compass_rose_in_status :Boolean
Defined in: adventure/Settings.js, line 751
Default value: true
show_disambiguation_as_ordered_list
show_disambiguation_as_ordered_list :Boolean
Defined in: adventure/Settings.js, line 241
Default value: false
'Disambiguation' means the player has asked for an object that could refer to multiple things, and the Parser hasn't been able to narrow it down to one object. Let's say there are three cats of different colors in the room. Normally the game would ask the player:
which cat did you mean, the orange cat, the black cat, or the piebald cat?If this is true, prompts will look like this instead:
Which cat did you mean? 1) the orange cat 2) the black cat 3) the piebald catWhen this is done, the player can enter 1, 2, or 3 and the parser will understand their choice.
For more information about Disambiguation, see How to Disambiguate
show_room_names_in_exit_descriptions
show_room_names_in_exit_descriptions :Boolean
Defined in: adventure/Settings.js, line 199
Default value: true
show_room_names_in_exit_descriptions_only_after_exit_has_been_used
show_room_names_in_exit_descriptions_only_after_exit_has_been_used :Boolean
Defined in: adventure/Settings.js, line 228
Default value: true
show_room_names_in_exit_descriptions_only_when_room_is_known
show_room_names_in_exit_descriptions_only_when_room_is_known :Boolean
Defined in: adventure/Settings.js, line 213
Default value: false
states
states :Object
Defined in: adventure/Settings.js, line 546
use_nested_verb_phase_hooks
use_nested_verb_phase_hooks :Boolean
Defined in: adventure/Settings.js, line 163
Default value: false
when_travel_fails_list_exits
when_travel_fails_list_exits :Boolean
Defined in: adventure/Settings.js, line 187
Default value: true
xz_determines_reachability
xz_determines_reachability :Boolean
Defined in: adventure/Settings.js, line 785
Default value: false
xz_determines_reachability
xz_determines_reachability :Boolean
Defined in: adventure/Settings.js, line 799
Default value: false
Todos: implement this