{"name":"BIS_fnc_music","title":"BIS fnc music","type":"function","url":"https://community.bistudio.com/wiki/BIS_fnc_music","revid":351904,"updated":"2024-01-23T11:34:10Z","groups":["Sound"],"status":"ok","games":{"arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"arma2oa 1.50","arma3_since":"0.50","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.\n\n> [!NOTE]\n> 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.","syntaxes":[{"syntax":"[tracklist, delay] call BIS_fnc_music","params":[{"name":"tracklist","type":"Array of Strings","optional":true,"default":"all game musics","description":"a list of CfgMusic classes","type_expr":"Array<String>","text":"tracklist: Array of Strings - (Optional, default all game musics) a list of CfgMusic classes"},{"name":"delay","type":"Number","optional":true,"default":"3","description":"delay in seconds between tracks","type_expr":"Number","text":"delay: Number - (Optional, default 3) delay in seconds between tracks"}],"returns":{"type":"Nothing","type_expr":"Nothing"}}],"examples":[{"code":["[[\"myMusic1\", \"myMusic2\"], 1] call BIS_fnc_music; // play the two musics in a random order"]},{"code":["[] call BIS_fnc_music; // play all game tracks randomly"]},{"code":["[] call BIS_fnc_music;\nprivate _startingPos = getPosWorld player;\nprivate _timeLimit = time + 30;\nwaitUntil { sleep 1; getPosWorld player distance _startingPos > 50 || time > _timeLimit };\nif (!isNil \"BIS_fnc_music_spawn\") then { terminate BIS_fnc_music_spawn };\nplayMusic \"\";"]}],"see_also":["playMusic","BIS_fnc_jukebox"]}