-
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.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).
"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).
See here.
See here.
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.
Set "playMode" to "dev" or "beta" when developing or beta-testing your game - see here for why!
settings.reportAllSvg = true
settings.test = false
When "reportAllSvg" is true
, the draw function will output the raw SVG to the console.
Set "test" to true
to allow unit testing (see here).
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