Repository navigation
Lua Script API: Sound & Music Functions
It plays a sound (Must Be a .OGG Format)
-
sound- The File name (Relative to located inmods/sounds/orassets/sounds/) -
volume- Optional value, volume percent goes from0to1. Default value:1 -
tag- (Optional) Should only be used if you want to pause, resume, change the time, volume or fade in/out your sound, if you don't want to use it, don't include a third value.
It plays a music (Must Be a .OGG Format)
-
sound- The File name (Relative to located inmods/music/orassets/music/) -
volume- A Optional value, volume percent goes from0to1. Default value:1 -
loop- A Optional value, if the music should loop indefinitely. Default value:false
This function will stop the sound and remove it permanently!
-
tag- The Sound tag
This function will pause the sound
-
tag- The Sound tag
This function will resume the sound
-
tag- The Sound tag
Example: Using playSound('confirmMenu', 0.5) will play the menu "Accept" sound with 50% volume
The sound will fade in on the start of the sound
-
tag- The Sound tag, leave this field empty if you want to do a fade in on the Background music instead -
duration- The time it takes for the volume to go from fromValue to toValue -
fromValue- Starting value. Default value is0 -
toValue- End value. Default value is1
The sound will fade out on the end of the sound
-
tag- The Sound tag, leave this field empty if you want to do a fade out on the Background music instead -
duration- The time it takes for the volume to go from the starting volume to toValue -
toValue- End value. Default value is0
It cancel the fade
-
tag- The Sound tag, leave this field empty if you want cancel the Background music's fade in/out instead
The music will fade in on the start of the music
-
tag- The Music tag, leave this field empty if you want to do a fade in on the Background music instead -
duration- The time it takes for the volume to go from fromValue to toValue -
fromValue- Starting value. Default value is 0 -
toValue- End value. Default value is 1
The music will fade out on the end of the music
-
tag- The Music tag, leave this field empty if you want to do a fade out on the Background music instead -
duration- The time it takes for the volume to go from the starting volume to toValue -
toValue- End value. Default value is 0
Set's the sound volume
-
tag- The Sound tag, leave this field empty if you want change the Background music's volume instead -
value- Goes from 0 to 1.
Sets the current sound's position in miliseconds
-
tag- The Sound tag -
value- New position Note: Value 5000 = 5 seconds
Get's the current sound volume
-
tag- The Sound tag, leave this field empty if you want get the Background music's volume instead
Gets the current sound's position in miliseconds
-
tag- The Sound tag
Is the page in some way inaccurate? an error, a typo, or outdated data? To report it, use the "Issue Tab". Or do you wish to include a new function or add new information? use the "Pull Request Tab". Help is always appreciated!
- Event Callbacks
- Custom Sprite
- Custom Text
- Object Functions
- General Functions
- Scripting & File Functions
- Game Input Control Functions
- Language Translation
- HScript Functions
- Custom Substates
- Custom Shaders
- Deprecated & Removed Functions
- Sound & Music Functions
- Tweens & Timers Functions
- Reflection Functions
- Variables