Difference between revisions of "GetSoundId"
From The Official Visionaire Studio: Adventure Game Engine Wiki
Line 1: | Line 1: | ||
− | + | ==getSoundId== | |
− | |||
− | |||
− | |||
− | |||
+ | <div class="command-min-version-info">Available since: <span class="command-min-version">v3.8</span></div> | ||
− | + | <div class="command-doc">Gets the sound ID of the specified sound if it is currently active.</div> | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | </ | ||
− | |||
+ | Lua Syntax: | ||
+ | <pre class="command-syntax">getSoundId(sounditem)</pre> | ||
+ | ===Arguments=== | ||
+ | ====sounditem==== | ||
+ | :'''"string" (string should contain 'vispath:' prefix)''' - Relative filename of sound. | ||
+ | ===Flags=== | ||
+ | ===Return Values=== | ||
+ | ;soundID | ||
+ | :Unique id referencing the requested sound or -1 if the sound is not active. | ||
+ | ===Examples=== | ||
+ | Example 1: | ||
<syntaxhighlight> | <syntaxhighlight> | ||
− | -- | + | -- store sound id of a currently active sound in a local variable |
− | local soundID = getSoundId( | + | local soundID = getSoundId('vispath:sounds/example.ogg') |
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Revision as of 17:11, 22 November 2013
getSoundId
Available since: v3.8
Gets the sound ID of the specified sound if it is currently active.
Lua Syntax:
getSoundId(sounditem)
Arguments
sounditem
- "string" (string should contain 'vispath:' prefix) - Relative filename of sound.
Flags
Return Values
- soundID
- Unique id referencing the requested sound or -1 if the sound is not active.
Examples
Example 1:
-- store sound id of a currently active sound in a local variable
local soundID = getSoundId('vispath:sounds/example.ogg')