{"name":"BIS_fnc_music","operator":null,"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","replaced_by":[],"games":[{"game":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.50"},{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.50"},"arma3_since":"0.50","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"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","since":null,"effect":null,"exec":null,"params":[{"name":"tracklist","type":"Array of Strings","optional":true,"default":"all game musics","description":"a list of CfgMusic classes","types":["Array","String"],"since":null,"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","types":["Number"],"since":null,"text":"delay: Number - (Optional, default 3) delay in seconds between tracks"}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"}}],"examples":[{"text":"```sqf\n[[\"myMusic1\", \"myMusic2\"], 1] call BIS_fnc_music; // play the two musics in a random order\n```","code":["[[\"myMusic1\", \"myMusic2\"], 1] call BIS_fnc_music; // play the two musics in a random order"]},{"text":"```sqf\n[] call BIS_fnc_music; // play all game tracks randomly\n```","code":["[] call BIS_fnc_music; // play all game tracks randomly"]},{"text":"```sqf\n[] 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 \"\";\n```","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 \"\";"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["playMusic","BIS_fnc_jukebox"],"notes":[],"categories":["Arma 2: Operation Arrowhead: Functions","Arma 2: Operation Arrowhead: New Functions","Arma 3: Functions","Function Group: Sound","Functions","Introduced with Arma 2: Operation Arrowhead version 1.50","Take On Helicopters: Functions"],"docblock":null,"filled_from_docblock":[]}