|
|
(One intermediate revision by one other user not shown) |
Line 1: |
Line 1: |
− | ==getSoundProperty==
| + | #REDIRECT [[Global Command: getSoundProperty]] |
− | | |
− | <div class="command-min-version-info">Available since: <span class="command-min-version">v3.8</span></div>
| |
− | | |
− | <div class="command-doc">Return the requested sound property</div>
| |
− | | |
− | Lua Syntax:
| |
− | <pre class="command-syntax">getSoundProperty(soundID, property)</pre>
| |
− | ===Arguments===
| |
− | ====soundID====
| |
− | :'''int''' - ID of sound to get property from.
| |
− | ====property====
| |
− | :'''"string"''' - Property to retrieve.Currently supported properties: "volume" (0 mute ... 100 full volume, -1 if volume could not be retrieved), "balance" (-100 ... left, 0 ... center, +100 ... right, 0 if balance could not be retrieved), "offset" (current position from beginning of the sound in milliseconds, -1 if offset could not be retrieved), "duration" (total duration of sound in milliseconds, -1 if duration could not be retrieved), "loop" (true if sound is looped, false it is only played once, false if loop property could not be retrieved), "playing" (true if sound is currently playing, false otherwise)."paused" (true if sound is currently paused, false if sound is playing or not active at all).
| |
− | ===Flags===
| |
− | ===Return Values===
| |
− | ;property
| |
− | :requested property value.
| |
− | ===Examples===
| |
− | Example 1: store the current playtime of a sound
| |
− | <syntaxhighlight>
| |
− | local soundID = getSoundId('vispath:sounds/example.ogg')
| |
− | local soundOffset = getSoundProperty(soundID, "offset")
| |
− | </syntaxhighlight>
| |
− | [[Category:Player Commands]] | |