Class: Settings
Defined in: adventure/Settings.js, line 6
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:
- can_auto_open_apertures
- can_auto_unlock_apertures
- can_auto_unseal_apertures
- climb_height
- enable_events
- handful
- if_inferred_multiple_indirect_objects_then_prompt
- if_input_is_an_asset_name_examine_it
- if_input_is_empty_print_room_description
- if_parser_has_no_response_print_this
- infer_indirect_objects_only_after_interaction
- jump_length
- log_level
- log_level
- log_trace_level
- max_undos
- mouthful
- move_verb_hooks_to_end_of_queue
- move_verb_hooks_to_start_of_queue
- on_tie_rope_to_max_objects_drop_rope
- on_tie_rope_to_takeable_object_take_object
- on_untie_rope_from_object_outside_inventory_take_rope
- person
- print_debug_messages
- pronouns
- randomize_arrays_in_getStringOrArrayOrFunction
- reach_height
- reach_length
- room_temperature
- 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_after_exit_has_been_used
- show_room_names_in_exit_descriptions_only_when_room_is_known
- show_room_names_in_exit_descriptions_only_when_room_is_known
- states
- stride_length
- throw_at_substance_prefers_bodies
- try_to_infer_indirect_objects
- when_travel_fails_list_exits
- xz_determines_reachability
Methods Collapse all |
set(props) → {adventurejs.Settings}
Defined in: adventure/Settings.js, line 675
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 |
can_auto_open_apertures :Boolean
can_auto_unlock_apertures :Boolean
can_auto_unseal_apertures :Boolean
climb_height :Boolean
Defined in: adventure/Settings.js, line 633
Default value: 1
enable_events :Boolean
Defined in: adventure/Settings.js, line 515
Default value: true
handful :Number
Defined in: adventure/Settings.js, line 428
Default value: 100
if_inferred_multiple_indirect_objects_then_prompt :Boolean
Defined in: adventure/Settings.js, line 574
Default value: true
try_to_infer_indirect_objects
results in multiple assets, prompt player to select one.
if_input_is_an_asset_name_examine_it :Boolean
Defined in: adventure/Settings.js, line 255
Default value: true
if_input_is_empty_print_room_description :Boolean
Defined in: adventure/Settings.js, line 210
Default value: false
if_parser_has_no_response_print_this :Boolean
Defined in: adventure/Settings.js, line 226
Default value: true
MyGame.settings.set({
if_parser_has_no_response_print_this: "I didn't understand $(input). ",
});
This example wraps the player's input in an element so that
it can be styled differently from the rest of the output. This
isn't required and you can omit the 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.
infer_indirect_objects_only_after_interaction :Boolean
Defined in: adventure/Settings.js, line 558
Default value: true
try_to_infer_indirect_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.
jump_length :Boolean
Defined in: adventure/Settings.js, line 651
Default value: 1
log_level :Number
Defined in: adventure/Settings.js, line 45
Default value: 1
log_level :Number
Defined in: adventure/Settings.js, line 65
Default value: 1
log_trace_level :Number
Defined in: adventure/Settings.js, line 57
Default value: 0
max_undos :Number
Defined in: adventure/Settings.js, line 36
Default value: 10
mouthful :Number
Defined in: adventure/Settings.js, line 417
Default value: 100
move_verb_hooks_to_end_of_queue :Boolean
Defined in: adventure/Settings.js, line 286
Default value: true
"You take the gold medallion. You take the brass medallion. Oh no, taking the onyx medallion transported you to the nether realms! You take the silver medallion."This option tries to provide a little bit of control over that by saying: if player picks up these four objects, take the cursed one last. It doesn't solve all problems. For instance, if two of our medallions each took the player to a different location, that might break something. Some situations can't be solved programmatically and just come down to good game design.
Alternately, you may want to handle assets with verb_hooks first. Let's say you have an explosive item, and if player inputs "take all" you want the explosive to be picked up first and then end the turn in order to prevent other items from handled in the same turn.
For more information on verb_hooks, see Verb Phases
Valid values are: -1 (move to beginning of queue), 0 (leave in place), 1 (move to end of queue). Warning: may cause undesired side effects.
move_verb_hooks_to_start_of_queue :Boolean
Defined in: adventure/Settings.js, line 324
Default value: false
on_tie_rope_to_max_objects_drop_rope :Boolean
Defined in: adventure/Settings.js, line 388
Default value: true
If the rope in that situation has a verb event hook for drop, it has the potential to cause undesirable side effects. It's an unlikely edge case, but if you find yourself in that situation, try setting this to false to avoid side effects.
on_tie_rope_to_takeable_object_take_object :Boolean
Defined in: adventure/Settings.js, line 372
Default value: true
If the asset in that situation is coded with a verb event hook, it has the potential to cause undesirable side effects. It's an unlikely edge case, but if you find yourself in that situation, try setting this to false to avoid side effects.
on_untie_rope_from_object_outside_inventory_take_rope :Boolean
Defined in: adventure/Settings.js, line 402
Default value: true
If the rope in that situation has a verb event hook for drop, it has the potential to cause undesirable side effects. It's an unlikely edge case, but if you find yourself in that situation, try setting this to false to avoid side effects.
person :String
Defined in: adventure/Settings.js, line 474
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_debug_messages :String
Defined in: adventure/Settings.js, line 507
print_debug_messages
is true, some failure responses may print
additional information to the game display.
Intended as a debugging aid.
pronouns :Object
Defined in: adventure/Settings.js, line 459
pronouns
setting is a lookup table
for use with person
.
randomize_arrays_in_getStringOrArrayOrFunction :Boolean
Defined in: adventure/Settings.js, line 264
Default value: true
Todos: List properties that this applies to.
For more information, see How to Use String|Array|Function
reach_height :Boolean
Defined in: adventure/Settings.js, line 616
Default value: 1
reach_length :Boolean
Defined in: adventure/Settings.js, line 625
Default value: .33
room_temperature :Number
Defined in: adventure/Settings.js, line 441
Default value: 20
Todos: celsius/farenheit conversion
show_compass_rose_in_status :Boolean
Defined in: adventure/Settings.js, line 582
Default value: true
show_disambiguation_as_ordered_list :Boolean
Defined in: adventure/Settings.js, line 150
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 :Boolean
Defined in: adventure/Settings.js, line 108
Default value: true
show_room_names_in_exit_descriptions_only_after_exit_has_been_used :Boolean
Defined in: adventure/assets/tangibles/Room.js, line 288
Default value: null
show_room_names_in_exit_descriptions_only_after_exit_has_been_used :Boolean
Defined in: adventure/Settings.js, line 137
Default value: true
show_room_names_in_exit_descriptions_only_when_room_is_known :Boolean
Defined in: adventure/assets/tangibles/Room.js, line 273
Default value: null
show_room_names_in_exit_descriptions_only_when_room_is_known :Boolean
Defined in: adventure/Settings.js, line 122
Default value: false
states :Object
Defined in: adventure/Settings.js, line 449
stride_length :Boolean
Defined in: adventure/Settings.js, line 642
Default value: .33
throw_at_substance_prefers_bodies :Boolean
Defined in: adventure/Settings.js, line 524
Default value: true
throw_at_substance_prefers_bodies
is true, the verb throw
's logic will
make that assumption, rather than prompting player
to specify an indirect object.
try_to_infer_indirect_objects :Boolean
Defined in: adventure/Settings.js, line 541
Default value: true
when_travel_fails_list_exits :Boolean
Defined in: adventure/Settings.js, line 96
Default value: true
xz_determines_reachability :Boolean
Defined in: adventure/Settings.js, line 660
Default value: false