BIS fnc music: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Generated by BIS_fnc_exportFunctionsToWiki)
 
m (Some wiki formatting)
 
(42 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{RV|type=function


{{Function|= Comments
|game1= arma2oa
____________________________________________________________________________________________
|version1= 1.50


| arma2oa |= Game name
|game2= tkoh
|version2= 1.00


|1.00|= Game version
|game3= arma3
____________________________________________________________________________________________
|version3= 0.50


| <pre>
|gr1= Sound
/*
File: fn_music.sqf


Description:
|descr= Randomly play provided tracks defined in [[Description.ext#CfgMusic|CfgMusic]] and does a 3 seconds [[fadeMusic|fade out]]. This function takes [[accTime]] into account. See also [[BIS_fnc_jukebox]].
Jukebox
{{Feature|informative|The function stores the script handle in the {{hl|BIS_fnc_music_spawn}} variable that can be used to stop the function; see {{Link|#Example 3}} for its usage example.}}


Parameter(s):
|s1= [tracklist, delay] call [[BIS_fnc_music]]
_this: ARRAY - list of used songs (Optional)
NUMBER - delay between tracks (Optional)


Returns:
|p1= tracklist: [[Array]] of [[String]]s - (Optional, default all game musics) a list of [[Description.ext#CfgMusic|CfgMusic]] classes
Nothing
*/


</pre><small>''(Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]])''</small> |= Description
|p2= delay: [[Number]] - (Optional, default 3) delay in seconds between tracks
____________________________________________________________________________________________


| <!-- [] call [[BIS_fnc_music]]; --> |= Syntax
|r1= [[Nothing]]


|p1= |= Parameter 1
|x1= <sqf>[["myMusic1", "myMusic2"], 1] call BIS_fnc_music; // play the two musics in a random order</sqf>


| |= Return value
|x2= <sqf>[] call BIS_fnc_music; // play all game tracks randomly</sqf>
____________________________________________________________________________________________


|x1= <code></code> |=
|x3= <sqf>
____________________________________________________________________________________________
[] call BIS_fnc_music;
 
private _startingPos = getPosWorld player;
| |= See also
private _timeLimit = time + 30;
waitUntil { sleep 1; getPosWorld player distance _startingPos > 50 || time > _timeLimit };
if (!isNil "BIS_fnc_music_spawn") then { terminate BIS_fnc_music_spawn };
playMusic "";
</sqf>


|seealso= [[playMusic]] [[BIS_fnc_jukebox]]
}}
}}
<h3 style="display:none">Notes</h3>
<dl class="command_description">
<!-- Note Section BEGIN -->
<!-- Note Section END -->
</dl>
<h3 style="display:none">Bottom Section</h3>
[[Category:Function Group: Misc|{{uc:music}}]]
[[Category:Functions|{{uc:music}}]]
[[Category:{{Name|arma2oa}}: Functions|{{uc:music}}]]
[[Category:{{Name|tkoh}}: Functions|{{uc:music}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:music}}]]

Latest revision as of 12:34, 23 January 2024

Hover & click on the images for description

Description

Description:
Randomly play provided tracks defined in CfgMusic and does a 3 seconds fade out. This function takes accTime into account. See also BIS_fnc_jukebox.
The function stores the script handle in the BIS_fnc_music_spawn variable that can be used to stop the function; see Example 3 for its usage example.
Execution:
call
Groups:
Sound

Syntax

Syntax:
[tracklist, delay] call BIS_fnc_music
Parameters:
tracklist: Array of Strings - (Optional, default all game musics) a list of CfgMusic classes
delay: Number - (Optional, default 3) delay in seconds between tracks
Return Value:
Nothing

Examples

Example 1:
[["myMusic1", "myMusic2"], 1] call BIS_fnc_music; // play the two musics in a random order
Example 2:
[] call BIS_fnc_music; // play all game tracks randomly
Example 3:
[] call BIS_fnc_music; private _startingPos = getPosWorld player; private _timeLimit = time + 30; waitUntil { sleep 1; getPosWorld player distance _startingPos > 50 || time > _timeLimit }; if (!isNil "BIS_fnc_music_spawn") then { terminate BIS_fnc_music_spawn }; playMusic "";

Additional Information

See also:
playMusic BIS_fnc_jukebox

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note