API:PlaySound
From RoR Wiki
UI Lua API · Game functions
Version: WAR 1.4.8
Plays a sound effect by ID.
PlaySound(soundId)
Arguments
- soundId
number– ID of the sound. The stock UI uses theGameData.Soundvalues (through theSoundconstants insoundutils.lua).
Returns
Nothing.
Details
- The sound is played as an interface sound, not at a position in the world.
- Nothing is played if the client's sound system is turned off or not ready. The client also skips the sound when one of its audio state flags is set or during one particular game state.
- Exactly one argument must be passed. A fractional ID is cut toward zero.
Errors
None besides the generic Invalid Parameters message when the argument is missing or not a number.
Example
Sound.Play from default/easystem_utils/source/soundutils.lua:
if( id ~= nil ) then
PlaySound( id )
else
DEBUG( L"EASystem_Utils//Source//SoundUtils.lua: Sound.Play() called with nil ID (maybe a type-o in constant name)" )
