-
Notifications
You must be signed in to change notification settings - Fork 17
Settings
The settings.js file gives the author the opportunity to customise the game to his or her liking.
In fact, there are two files, one in "lib" where the defaults are set, and one in "game" for authors. You just need to include the values you want to change in your own settings.js file.
Settings are all attributes of the settings
object, and you can add also your own custom attributes - but be aware that none of these attributes are saved when the player saves their game, so they should not be used to track game state (i.e., in general they should never change during play; the only exception might be player customisation of the interface).
The values in the code snippets below are the defaults, except where noted.
The first section is a set of constants for meta-data.
settings.title = "A First Step..."
settings.author = "The Pixie"
settings.subtitle = "An example game for Quest 6"
settings.version = "1.0"
settings.thanks = ["Kyle", "Lara"];
settings.warnings = 'No warning relevant for this game.'
Basic info about your game. Note that the first two are required (there is no default), and these are the only setting you must have in "settings.js". The "thanks" setting is an empty array by default; it is shown here with two entries to show how it should be formatted.
The "warnings" setting is useful for players who might have issues with certain games (for example, a description of a lavish meal might upset someone with an eating disorder, and graphics depictions of violence or sex should definitely be mentioned). Players can choose to use the WARNING command to see this information. You may also want to include further warnings that show automatically when your game starts in more extreme cases. I appreciate this is somewhat subjective.
settings.panes = 'Left'
settings.compass = true
settings.divider = "div.png"
settings.statusPane = "Status"
settings.statusWidthLeft = 120
settings.statusWidthRight = 40
settings.status = [
function() { return "<td>Health points:</td><td>" + game.player.hitpoints + "</td>"; },
]
settings.inventories = [
{name:'Items Held', alt:'itemsHeld', test:util.isHeldNotWorn, getLoc:function() { return game.player.name; } },
{name:'Items Worn', alt:'itemsWorn', test:util.isWorn, getLoc:function() { return game.player.name; } },
{name:'Items Here', alt:'itemsHere', test:util.isHere, getLoc:function() { return game.player.loc; } },
]
The panes
value can be set to "left", "right" or "none". If set to anything else, the panes will be hidden, but still get drawn. Setting the value to "none" stops them getting drawn at all, so will be faster (though doubtful anyone will notice).
The compassPane
value turns the compass on or off. Set symbolsForCompass
to true to have arrows, etc. instead of characters in the compass rose.
The statusPane
value sets the name of the status pane. Set to false
to turn it off. The status values will be set out in a table to keep values neatly aligned, use statusWidthLeft
and statusWidthRight
to adjust the column widths.
The "status" value is an array of functions, where each function should return an HTML string defining two TD elements, the name and the value (this will get inserted into a TR, so the <tr>
tags should not be included).
The "inventoryPane" value is an array of dictionaries. Set to an empty array to turn off inventories.
Note that the default help command will modify its text based on these settings, so it will be automatically customised for your game.
These are pretty self-explanatory.
settings.textInput = true // player types commands
settings.cursor = ">" // prompt for the commands
settings.cmdEcho = true // input commands are repeated on screen
settings.typewriter = false // if true there is a delay between each character when text is printed
settings.typewriterDelay = 25
This less so:
settings.roomTemplate = [
"{hereDesc}",
"{objectsHere:You can see {objects} here.}",
"{exitsHere:You can go {exits}.}",
]
This defines what the player sees on entering a room (or typing LOOK). Each entry in the array will be a paragraph of text, and they all use the text processor. The first line gives the description for the room (the text processor directive hereDesc
should not be used in any other context). The second line is a list of objects here, the third line a list of possible exits (but the text processor directives mean that these are only used if there is something to list).
This alternative adds the room name as a heading, allows TERSE/BRIEF and VERBOSE to control the room description, and has no exit list.
settings.roomTemplate = [
"#{cap:{hereName}}",
"{terse:{hereDesc}}",
"{objectsHere:You can see {objects} here.}",
]
settings.failCountsAsTurn = false
settings.lookCountsAsTurn = false
settings.saveDisabled = false
settings.splitLinesOn = "<br>"
settings.convertNumbersInParser = true
settings.maxUndo = 10
settings.moneyFormat = "$!"
By default Quest 6 does not count it as a turn if the player types something that the parser cannot understand (which is different to when the parser understands but the character cannot do the action). Also by default, Quest 6 also does not consider LOOK to take a turn. The first two allow you to change that.
You also have the option to disable saving.
Quest 5 considers "<br>" in a string to be a line break. Quest 6 does not work quite the same so you can have it use whatever you want.
If you use COUNTABLEs, the player can type GET FIVE BRICKS. The parser convert the word "FIVE" to the digit "5" (and any number from 0 to 20), which the COUNTABLE system can then handle. If "convertNumbersInParser" is set to false, the player will have to type the digits, not the word for the number. However, you may not want that if you have items with numbers in their names (though there are ways around that using the items "regex" attribute). Commands will process faster if this is set to false (say around 20% faster, though on my system they take around 2 ms, so not noticeable anyway).
When "debug" is true, some extra commands are available. Set to false
before releasing!
"maxUndo" is the maximum number of times the player can undo (i.e., by default Quest 6 remembers the last ten turns). Set to zero to disable.
"moneyFormat" is clearly the format for money
There are also various settings connected to specific features, but these are discussed in the pages on about the relevant feature and better read in that context.
For all these settings, filenames should be given without the path or extension.
settings.lang = "lang-en" // Set to the language file of your choice
settings.customExits = false // Set to the filename to use otherwise
settings.libraries = ["saveload", "text", "io", "command", "defaults", "templates", "world", "npc", "parser", "commands"]
settings.customLibraries = []
settings.files = ["code", "data"] // Additional files to load
"lang" allows you to set the language. "customExits" allows you to override the normal "north", "south", set it to the name of the file in your game folder.
"customLibraries" allows you to add custom libraries to your game. A library is a set of files (or just one) that might be used across multiple games, possibly shared with other authors. Each entry in the array should be a dictionary with a "folder" entry, a string, and a "files" entry, an array of filenames.
The "files" array is an array of files specific to your game. By convention, "code.js" has functions, commands and other stuff, while "data.js" has all the objects, but you may want to add other files (I like to have one for NPCs for example).
If you want to track time, you may want to investigate what the options mean here.
settings.dateTime = {
year:"numeric",
month:"short",
day:"2-digit",
hour:"2-digit",
minute:"2-digit",
secondsPerTurn:60,
locale:'en-GB',
start:new Date('February 14, 2019 09:43:00'),
}
The most important one is the start time, which you can set like this:
settings.dateTime.start = new Date('April 14, 2387 09:43:00')
Use the getDateTime()
function to get the current game time as a string (game.elapsedTime
is used to record the number of seconds that have passed in game since the game started).
Note that Quest 6 can handle dates about a quarter of a million years into the future or past, beyond that it will become less and less accurate (but may get confused by changes to the calender, for example with the missing days of 1752!).
These are used when the game starts, if set. "setup" must be a function, and "intro" a string. Note that "intro" is printed first so the player has something to read while "setup" runs.
To see how to create a dialog box at start up for character creation, see here.
Useful when writing your game.
settings.debug = true
settings.test = false
settings.shortcutCommand = 'test'
When "debug" is true
some extra commands are added to your game (see here).
Set "test" to true
to allow unit testing (see here).
The "shortcutCommand" fires when the player presses 0 on the number pad. By default it runs the unit tests, but can be set to anything. If you are testing by using a walk-though called "wt1" you could set it to 'wt wt1', then you just need to press one button to run the walk-through.
Tutorial
- First steps
- Rooms and Exits
- Items
- Templates
- Items and rooms again
- More items
- Locks
- Commands
- Complex mechanisms
- Uploading
QuestJS Basics
- General
- Settings
- Attributes for items
- Attributes for rooms
- Attributes for exits
- Naming Items and Rooms
- Restrictions, Messages and Reactions
- Creating objects on the fly
- String Functions
- Random Functions
- Array/List Functions
- The
respond
function - Other Functions
The Text Processor
Commands
- Introduction
- Basic commands (from the tutorial)
- Complex commands
- Example of creating a command (implementing SHOOT GUN AT HENRY)
- More on commands
- Shortcut for commands
- Modifying existing commands
- Custom parser types
- Note on command results
- Meta-Commands
- Neutral language (including alternatives to "you")
- The parser
- Command matching
- Vari-verbs (for verbs that are almost synonyms)
Templates for Items
- Introduction
- Takeable
- Openable
- Container and surface
- Locks and keys
- Wearable
- Furniture
- Button and Switch
- Readable
- Edible
- Vessel (handling liquids)
- Components
- Countable
- Consultable
- Rope
- Construction
- Backscene (walls, etc.)
- Merchandise (including how to create a shop)
- Shiftable (can be pushed from one room to another)
See also:
- Custom templates (and alternatives)
Handing NPCs
- Introduction
- Attributes
- Allowing the player to give commands
- Conversations
- Simple TALK TO
- SAY
- ASK and TELL
- Dynamic conversations with TALK TO
- TALK and DISCUSS
- Following an agenda
- Reactions
- Giving
- Followers
- Visibility
- Changing the player point-of-view
The User Experience (UI)
The main screen
- Basics
- Printing Text Functions
- Special Text Effects
- Output effects (including pausing)
- Hyperlinks
- User Input
The Side Panes
Multi-media (sounds, images, maps, etc.)
- Images
- Sounds
- Youtube Video (Contribution by KV)
- Adding a map
- Node-based maps
- Image-based maps
- Hex maps
- Adding a playing board
- Roulette!... in a grid
Dialogue boxes
- Character Creation
- Other example dialogs [See also "User Input"]
Other Elements
- Toolbar (status bar across the top)
- Custom UI Elements
Role-playing Games
- Introduction
- Getting started
- Items
- Characters (and Monsters!)
- Spawning Monsters and Items)
- Systema Naturae
- Who, When and How NPCs Attack
- Attributes for characters
- Attacking and guarding
- Communicating monsters
- Skills and Spells
- Limiting Magic
- Effects
- The Attack Object
- [Extra utility functions](https://github.com/ThePix/QuestJS/wiki/RPG-Library-%E2%80%90-Extra Functions)
- Randomly Generated Dungeon
- Quests for Quest
- User Interface
Web Basics
- HTML (the basic elements of a web page)
- CSS (how to style web pages)
- SVG (scalable vector graphics)
- Colours
- JavaScript
- Regular Expressions
How-to
Time
- Events (and Turnscripts)
- Date and Time (including custom calendars)
- Timed Events (i.e., real time, not game time)
Items
- Phone a Friend
- Using the USE verb
- Display Verbs
- Change Listeners
- Ensembles (grouping items)
- How to spit
Locations
- Large, open areas
- Region,s with sky, walls, etc.
- Dynamic Room Descriptions
- Transit system (lifts/elevators, buses, trains, simple vehicles)
- Rooms split into multiple locations
- Create rooms on the fly
- Handling weather
Exits
- Alternative Directions (eg, port and starboard)
- Destinations, Not Directions
Meta
- Customise Help
- Provide hints
- Include Achievements
- Add comments to your code
-
End The Game (
io.finish
)
Meta: About The Whole Game
- Translate from Quest 5
- Authoring Several Games at Once
- Chaining Several Games Together
- Competition Entry
- Walk-throughs
- Unit testing
- Debugging (trouble-shooting)
Releasing Your Game
Reference
- The Language File
- List of settings
- Scope
- The Output Queue
- Security
- Implementation notes (initialisation order, data structures)
- Files
- Code guidelines
- Save/load
- UNDO
- The editor
- The Cloak of Darkness
- Versions
- Quest 6 or QuestJS
- The other Folders
- Choose your own adventure