Difference between revisions of "Global Command: getVolume"
From The Official Visionaire Studio: Adventure Game Engine Wiki
(Created page with "<div class="toccolours mw-collapsible mw-collapsed tbl-ds"> <span class="bold">Function History</span> <div class="mw-collapsible-content"> <div class="alt-bg">Available since...") |
m (EK moved page GetVolume (CMS) to Global Command: getVolume) |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | + | Retrieve the general volume levels for music, sound, speech, videos, and master. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | {| class="ts" | |
− | + | |- | |
− | + | | style="width:15%" | Related functions | |
− | + | | [[Global Command: setVolume|setVolume]] | |
− | + | |} | |
− | |||
− | |||
− | |||
− | Syntax | + | == Syntax == |
− | <syntaxhighlight> | + | <syntaxhighlight lang="lua"> |
getVolume(type) | getVolume(type) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | == Parameters == | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | - | + | {| class="ts" |
− | + | |- | |
− | + | ! style="width:15%" | Parameter | |
− | + | ! style="width:10%" | Type | |
+ | ! style="width:15%" | Supported values | ||
+ | ! Description | ||
+ | |- | ||
+ | | rowspan="5" | type | ||
+ | | rowspan="5" | integer | ||
+ | | eMusicVolume (0) | ||
+ | | rowspan="5" | The type of volume to return. | ||
− | |||
− | |||
− | |||
− | |||
− | -- | + | ''The available types are members of the [https://www.visionaire-studio.com/luadocs/lua.html#sound-volume-types sound volume enumeration]. The parameter can be passed as name (e. g. eMusicVolume), or number (e. g. 0), see the examples.'' |
− | + | |- | |
− | + | | eSoundVolume (1) | |
− | + | |- | |
− | + | | eSpeechVolume (2) | |
+ | |- | ||
+ | | eMovieVolume (3) | ||
+ | |- | ||
+ | | eGlobalVolume (4) | ||
+ | |} | ||
+ | == Return values == | ||
− | + | {| class="ts" | |
+ | |- | ||
+ | ! style="width:15%" | Type | ||
+ | ! Description | ||
+ | |- | ||
+ | | integer | ||
+ | | The queried volume level in the range of 0 to 100. | ||
+ | |} | ||
− | |||
− | |||
+ | == Examples == | ||
− | < | + | '''Example 1:''' Enable the text output, if the speech volume level is below 30. |
+ | <syntaxhighlight lang="lua"> | ||
+ | if getVolume(eSpeechVolume) < 30 then | ||
+ | game.TextOutput = eTextAndSpeechOutput | ||
+ | end | ||
− | + | -- You can also pass the volume type as an integer. The following code will do the same. | |
− | + | if getVolume(2) < 30 then | |
− | + | game.TextOutput = eTextAndSpeechOutput | |
− | + | end | |
− | + | </syntaxhighlight> | |
− | + | {{toc}} | |
− | The | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Latest revision as of 21:28, 4 May 2023
Retrieve the general volume levels for music, sound, speech, videos, and master.
Related functions | setVolume |
Syntax
getVolume(type)
Parameters
Parameter | Type | Supported values | Description |
---|---|---|---|
type | integer | eMusicVolume (0) | The type of volume to return.
|
eSoundVolume (1) | |||
eSpeechVolume (2) | |||
eMovieVolume (3) | |||
eGlobalVolume (4) |
Return values
Type | Description |
---|---|
integer | The queried volume level in the range of 0 to 100. |
Examples
Example 1: Enable the text output, if the speech volume level is below 30.
if getVolume(eSpeechVolume) < 30 then
game.TextOutput = eTextAndSpeechOutput
end
-- You can also pass the volume type as an integer. The following code will do the same.
if getVolume(2) < 30 then
game.TextOutput = eTextAndSpeechOutput
end