The *sound command plays a supported audio file which should be in the same folder or address as the ChoiceScript game's main files.

Usage Edit

*sound ASoundFile.mp3

The sound file can be accessible via a web address, or in the same folder/path as the game's HTML file. If the file is in the same folder as the game, you can simply use filename.mp3 without a full URL or path.

Tested with Chrome, using OGG, MP3, and WAV file formats, though what audio formats can be played may rely on what browser and system the player is using.

Sounds do not seem to loop, and any new sound commands will stop any currently playing sounds or music and play the new sound instead.

Be aware that MP3 is a proprietary file format, and technically can't be used for games that have a distribution of more than 5,000 copies without paying a licensing fee, and as such, OGG might be a better choice for use in ChoiceScript.

Stopping a Playing Sound Edit

Using the sound command to call a non-existing sound file, or any text that isn't a sound file, will stop all sounds.

*sound nothing

More commands
Choice *choice, *fake_choice, *disable_reuse, *hide_reuse, *allow_reuse, *selectable_if
Variable *create, *temp, *set, Arithmetic operators, *delete, *input_number, *input_text, *print, *rand
Conditional *if, *elseif, *else
Goto *label, *goto, *goto_scene, *goto_random_scene, *gosub, *gosub_scene, *finish
Formatting Bold text, Italic text, *image, *line_break, *page_break, *link, *stat_chart
Miscellaneous *comment, *scene_list, *title, *author, *achieve, *achievement, *check_achievements, *bug, *ending, *more_games, *share_this_game, *show_password, *script