Difference between revisions of "GetVolume"

From The Official Visionaire Studio: Adventure Game Engine Wiki
Line 1: Line 1:
<div class="toccolours mw-collapsible mw-collapsed tbl-ds">
+
==getVolume==
<span class="bold">Command History</span>
 
<div class="mw-collapsible-content">
 
<div class="alt-bg">Available since v3.7</div>
 
<div>MovieVolume & GlobalVolume added to v3.8</div>
 
</div></div>
 
  
 +
<div class="command-min-version-info">Available since: <span class="command-min-version">v3.0</span></div>
  
Allows the user to check current volume levels of: music, sound fx, speech, movies & global(master)
+
<div class="command-doc">Returns the general volume for background music, sound or speech output.</div>
<div class="toccolours mw-collapsible mw-collapsed tbl-ds">
 
<span class="bold">Additional Info</span>
 
<div class="mw-collapsible-content">
 
<div>These are the names or numbers used inside of the getVolume(brackets) to check specific volume types! <br/>
 
<pre>eMusicVolume(0), eSoundVolume(1), eSpeechVolume(2), eMovieVolume(3) or eGlobalVolume(4)</pre></div>
 
</div></div>
 
  
 
+
Lua Syntax:
Syntax:
+
<pre class="command-syntax">getVolume(type)</pre>
<syntaxhighlight>
+
===Arguments===
getVolume(type)
+
====type====
</syntaxhighlight>
+
:'''int''' - The type of volume to return: eMusicVolume (0), eSoundVolume (1), eSpeechVolume (2), eMovieVolume (3) or eGlobalVolume (4).
 
+
===Flags===
 
+
===Return Values===
Example:
+
;volume
 +
:The queried volume.
 +
===Examples===
 +
Example 1:  
 
<syntaxhighlight>
 
<syntaxhighlight>
 
-- is music volume over 50%?
 
-- is music volume over 50%?
 
if getVolume(eMusicVolume) > 50 then
 
if getVolume(eMusicVolume) > 50 then
-- do some action!
+
-- do some action
 
end
 
end
 
+
</syntaxhighlight>
-- is sound fx volume less than 25%?
+
Example 2:
if getVolume(eSoundVolume) < 25 then
+
<syntaxhighlight>
-- do some action!
 
end
 
 
 
 
-- is speech volume more than or equal to 80%?
 
-- is speech volume more than or equal to 80%?
 
if getVolume(eSpeechVolume) >= 80 then
 
if getVolume(eSpeechVolume) >= 80 then
-- do some action!
+
-- do some action
 
end
 
end
 
+
</syntaxhighlight>
-- is movie volume at 50%?
+
Example 3:
if getVolume(eMovieVolume) == 50 then
+
<syntaxhighlight>
-- do some action!
 
end
 
 
 
 
-- is global (master) volume not equal to 50%?
 
-- is global (master) volume not equal to 50%?
 
if getVolume(eGlobalVolume) ~= 50 then
 
if getVolume(eGlobalVolume) ~= 50 then
-- do some action!
+
-- do some action
 
end
 
end
 
</syntaxhighlight>
 
</syntaxhighlight>
 
 
 
<span class="bold underline">Arguments</span>
 
 
<span class="bold">type</span>: integer (number) <br/>
 
The type of volume to return: eMusicVolume(0), eSoundVolume(1), eSpeechVolume(2), eMovieVolume(3) or eGlobalVolume(4)
 
 
 
<span class="bold underline">Flags</span>
 
 
none
 
 
 
<span class="bold underline">Return</span>
 
 
<span class="bold">volume</span> <br/>
 
The queried volume
 
{{i18n|GetVolume}} <br/>
 
{| class="tbl-ds"
 
|-
 
|<span class="bold">Relevant Pages</span>: [[SetVolume|setVolume]]
 
|}
 

Revision as of 17:12, 22 November 2013

getVolume

Available since: v3.0
Returns the general volume for background music, sound or speech output.

Lua Syntax:

getVolume(type)

Arguments

type

int - The type of volume to return: eMusicVolume (0), eSoundVolume (1), eSpeechVolume (2), eMovieVolume (3) or eGlobalVolume (4).

Flags

Return Values

volume
The queried volume.

Examples

Example 1:

-- is music volume over 50%?
if getVolume(eMusicVolume) > 50 then
-- do some action
end

Example 2:

-- is speech volume more than or equal to 80%?
if getVolume(eSpeechVolume) >= 80 then
-- do some action
end

Example 3:

-- is global (master) volume not equal to 50%?
if getVolume(eGlobalVolume) ~= 50 then
-- do some action
end