Sound

The *sound command plays a supported audio file which should be in the same folder or address as the ChoiceScript game's main files. *sound 命令用于播放受支持的音频文件,该文件应位于与 ChoiceScript 游戏主文件相同的文件夹或地址中。

Usage

用法

*sound ASoundFile.mp3
*sound http://www.somesite.com/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. 音频文件可通过网络地址访问,或位于与游戏 HTML 文件相同的文件夹/路径中。如果文件与游戏位于同一文件夹,你可以直接使用 filename.mp3,而无需完整的 URL 或路径。

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. 已在 Chrome 浏览器中测试过 OGG、MP3 和 WAV 文件格式,但可播放的音频格式可能取决于玩家使用的浏览器和系统。

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. 声音似乎不会循环播放,任何新的 sound 命令都会停止当前正在播放的任何声音或音乐,转而播放新的声音。

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 feearrow-up-right, and as such, OGGarrow-up-right might be a better choice for use in ChoiceScript. 请注意,MP3是一种专有文件格式,从技术上讲,如果游戏发行量超过5000份,则需支付许可费才能使用,因此OGG可能是ChoiceScript中更好的选择。

Stopping a Playing Sound

停止播放中的声音

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命令调用不存在的音效文件或任何非音效文件的文本,将会停止所有声音的播放。

*sound nothing