playMusic: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\[\[Category:[cC]ommand[_ ][gG]roup:[_ ][^|]+\|\{*uc:{{PAGENAME}*]\]" to "")
m (Text replacement - " *\| *([Cc]omments|COMMENTS|Game|[Gg]ame [Nn]ame|Game [Vv]ersion|Game Version \(number surrounded by NO SPACES\)|Multiplayer Arguments( \("local" or "global"\))?|Effects|Multiplayer Effects( \("local" or "global"\))?|Multiplayer Exe...)
Line 1: Line 1:
{{Command|Comments=
{{Command


| ofp |Game name=
| ofp


|1.00|Game version=
|1.00


|eff= local |Multiplayer Effects=
|eff= local


|gr1= Sounds |GROUP1=
|gr1= Sounds


| Plays music defined in [[Description.ext#CfgMusic|Description.ext's CfgMusic]] or config.cpp. If the ''musicName'' could not be found a message is logged into the .rpt file: <tt>Music <''musicName''> not found</tt>.
| Plays music defined in [[Description.ext#CfgMusic|Description.ext's CfgMusic]] or config.cpp. If the ''musicName'' could not be found a message is logged into the .rpt file: <tt>Music <''musicName''> not found</tt>.
Line 16: Line 16:
{{Informative | To stop the music, use {{Inline code|[[playMusic]] ""}}.}}
{{Informative | To stop the music, use {{Inline code|[[playMusic]] ""}}.}}


{{Feature|arma3 | See [[Arma 3 CfgMusic]] for possible vanilla values. Since {{arma3}} v1.67 one can use the [[Arma_3_Utilities#Jukebox|Jukebox Utility]] to preview in-game music.}} |DESCRIPTION=
{{Feature|arma3 | See [[Arma 3 CfgMusic]] for possible vanilla values. Since {{arma3}} v1.67 one can use the [[Arma_3_Utilities#Jukebox|Jukebox Utility]] to preview in-game music.}}


| [[playMusic]] musicName |SYNTAX=
| [[playMusic]] musicName


|p1= musicName: [[String]] - music classname |Parameter1=
|p1= musicName: [[String]] - music classname


|[[Nothing]] |RETURNVALUE=
|[[Nothing]]


|s2= [[playMusic]] [musicName, start] |SYNTAX2=
|s2= [[playMusic]] [musicName, start]


|p21= musicName: [[String]] - music classname |PARAMETER21=
|p21= musicName: [[String]] - music classname |PARAMETER21=
Line 30: Line 30:
|p22= start: [[Number]] - start, in seconds. Can be negative. |PARAMETER22=
|p22= start: [[Number]] - start, in seconds. Can be negative. |PARAMETER22=


|r2= [[Nothing]] |RETURNVALUE2=
|r2= [[Nothing]]


|x1= <code>[[playMusic]] "RadioAmbient1";</code> |EXAMPLE1=
|x1= <code>[[playMusic]] "RadioAmbient1";</code>


|x2= <code>[[playMusic]] ["RadioAmbient3", 3]; {{cc|start to play from 00:00:03}}</code> |EXAMPLE2=
|x2= <code>[[playMusic]] ["RadioAmbient3", 3]; {{cc|start to play from 00:00:03}}</code>


|x3= Play from 00:00:01 to 00:00:05:
|x3= Play from 00:00:01 to 00:00:05:
Line 41: Line 41:
[[sleep]] 4;
[[sleep]] 4;
[[playMusic]] "";
[[playMusic]] "";
};</code> |EXAMPLE3=
};</code>


| [[getMusicPlayedTime]], [[playSound]], [[say]], [[createSoundSource]], [[addMusicEventHandler]], [[fadeMusic]] |SEEALSO=
| [[getMusicPlayedTime]], [[playSound]], [[say]], [[createSoundSource]], [[addMusicEventHandler]], [[fadeMusic]]
}}
}}



Revision as of 02:27, 18 January 2021

Hover & click on the images for description

Description

Description:
Plays music defined in Description.ext's CfgMusic or config.cpp. If the musicName could not be found a message is logged into the .rpt file: Music <musicName> not found.
To stop the music, use playMusic "".
Arma 3
See Arma 3 CfgMusic for possible vanilla values. Since Arma 3 v1.67 one can use the Jukebox Utility to preview in-game music.
Groups:
Sounds

Syntax

Syntax:
playMusic musicName
Parameters:
musicName: String - music classname
Return Value:
Nothing

Alternative Syntax

Syntax:
playMusic [musicName, start]
Parameters:
musicName: String - music classname
start: Number - start, in seconds. Can be negative.
Return Value:
Nothing

Examples

Example 1:
playMusic "RadioAmbient1";
Example 2:
playMusic ["RadioAmbient3", 3]; // start to play from 00:00:03
Example 3:
Play from 00:00:01 to 00:00:05: [] spawn { playMusic ["RadioAmbient5", 1]; sleep 4; playMusic ""; };

Additional Information

See also:
getMusicPlayedTimeplaySoundsaycreateSoundSourceaddMusicEventHandlerfadeMusic

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

Bottom Section