-
Notifications
You must be signed in to change notification settings - Fork 18
Adding Sounds
It is easy to add sounds to your game.
The first step is to actually get hold of some sound files. By default, Quest will expect MP3, and generally this is the best format to use, as it is general-purpose, well-compressed and pretty much every browser can cope with it.
Bear in mind that music and sound effects can be subject to copyright, but there are numerous sites on the internet offering copyright-free files, though generally you do have to give an e-mail address to log in before you can download anything. One definitely to look at is "Sound Image", which is free and Eric, the guy who runs the site, knows Quest at least to some degree. Just remember to credit him!
If you are creating your own, I vey much recommend Audacity. It is free and open-source, and will let you export to MP3.
Grab all the files you want and put them into a folder called "audio", in your game folder.
NOTE: Some file systems are case-sensitive and some are not. Windows, for example, is not case-sensitive, and you may find that sounds work fine on your computer, but not when uploaded. The reason could be because the file name is all lowercase, but you have written it with a capital in your code. I recommend being careful and getting it right from the start.
You have to tell Quest what files you will use in advance. This means listing them in settings.js by assigning them to settings.soundFiles.
settings.soundFiles = [
'Bells4',
'Coins3',
'Light-Years_V001_Looping',
'Theyre-Here_Looping',
]
If you gave your folder a different name, you can tell Quest here, or if you are using a different file format. Note the folder needs a slash after it, and the extension needs a dot before it.
settings.soundsFolder = 'sounds/'
settings.soundsFileExt:'.mp3'
If you are using a mix of formats, set the extension to an empty string.
settings.soundsFileExt:''
settings.soundFiles = [
'Bells4.mp3',
'Coins3.mp3',
'Light-Years_V001_Looping.mp3',
'Theyre-Here_Looping.wav',
]
Quest understands two types of acoustics: sound and ambient. In both cases, the function requires the relevant file name.
A sound is relatively short, and it runs once (but you can call the function more than once to have it repeat).
sound('Bells4.mp3')
An ambient is continuous; background music or noise. When you start a new ambient, the old one will terminate. As it is part of the background, you might want it to play quieter, so ambient takes an optional second parameter, the volume from 0 (silent) to 10 (full volume, the default). Use ambient with no parameters to stop the current ambient.
ambient('Theyre-Here_Looping.wav')
ambient('Light-Years_V001_Looping.mp3', 5)
ambient()
Note that the SILENT command will turn off sounds. More specifically, it will terminate any ambient, but not on-goings sound, and will prevent either from starting. Typing SILENT a second time will allow any new sound and ambient to start.
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
respondfunction - 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