addMusicEventHandler: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\| *(arg|eff|mp|serverExec|gr[0-9]) *= *(.*) * *\|([^=]{12})" to "|$1=$2 |descr=$3")
(Add EH link)
 
(14 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{RV|type=command
{{RV|type=command


| arma3
|game1= arma3
|version1= 0.50


|0.50
|eff= local


|gr1= Event Handlers
|gr1= Event Handlers
Line 9: Line 10:
|gr2= Sounds
|gr2= Sounds


|descr= Adds [[playMusic]] event handler. Returns id of the handler or -1 when failed. Just like [[addMissionEventHandler]], music EH is also attached to the mission.
|descr= Adds [[playMusic]] event handler. Returns id of the handler or -1 when failed. Like [[addMissionEventHandler]], the music event handler is attached to the mission.
See {{Link|Arma 3: Event Handlers#Music Event Handlers}}.


|s1= '''addMusicEventHandler''' [type, function]
|s1= [[addMusicEventHandler]] [type, function]


|p1= [type, function]: [[Array]]
|p1= type: [[String]] - "MusicStart" or "MusicStop"


|p2= type: [[String]] - "MusicStart" or "MusicStop"
|p2= function: [[String]] or [[Code]] - passed params array is [musicClassname, eventHandlerId] where:
 
<sqf>params ["_musicClassname", "_ehId"];</sqf>
|p3= function: [[String]] or [[Code]]. Passed params array:
* musicClassname: [[String]] - [[Description.ext#Music|CfgMusic]] class name
* 0: [[Description.ext#Music|CfgMusic]] class name
* eventHandlerId: [[Number]] - event handler id
* 1: this event handler id


|r1= [[Number]] - event handler id
|r1= [[Number]] - event handler id


|x1= <code>_ehID = [[addMusicEventHandler]] ["MusicStart", {[[hint]] [[str]] _this}];</code>
|x1= <sqf>private _ehID = addMusicEventHandler ["MusicStart", { hint str _this }];</sqf>


|x2= <code>_ehID = [[addMusicEventHandler]] ["MusicStop", {[[hint]] [[str]] _this}];</code>
|x2= <sqf>private _ehID = addMusicEventHandler ["MusicStop", { hint str _this }];</sqf>


|seealso= [[setMusicEventHandler]], [[playMusic]], [[removeMusicEventHandler]], [[removeAllMusicEventHandlers]]
|seealso= [[removeMusicEventHandler]] [[playMusic]] {{Link|Arma 3: Event Handlers#Music Event Handlers}} [[removeAllMusicEventHandlers]] [[getEventHandlerInfo]]
}}
}}


<dl class="command_description">
{{Note
 
|user= Druid
<dt><dt>
|timestamp= 20130304133000
<dd class="notedate">Posted on March 4, 2013 - 13:30</dd>
|text= There are these two types at this time:
<dt class="note">[[User:Druid|Druid]]</dt>
* '''MusicStart''' - It is triggered when the music is started (command [[playMusic]]). In variable _this is stored class name from [[Description.ext#Music|CfgMusic]].
<dd class="note">There are these two types at this time:<br>
* '''MusicStop''' - It is triggered when the music is ended (command [[playMusic]]). In variable _this is stored class name from [[Description.ext#Music|CfgMusic]].
'''MusicStart''' - It is triggered when the music is started (command [[playMusic]]). In variable _this is stored class name from [[Description.ext#Music|CfgMusic]].<br>
}}
'''MusicStop''' - It is triggered when the music is ended (command [[playMusic]]). In variable _this is stored class name from [[Description.ext#Music|CfgMusic]].
 
</dl>

Latest revision as of 19:31, 21 May 2023

Hover & click on the images for description

Description

Description:
Adds playMusic event handler. Returns id of the handler or -1 when failed. Like addMissionEventHandler, the music event handler is attached to the mission. See Arma 3: Event Handlers - Music Event Handlers.
Groups:
Event HandlersSounds

Syntax

Syntax:
addMusicEventHandler [type, function]
Parameters:
type: String - "MusicStart" or "MusicStop"
function: String or Code - passed params array is [musicClassname, eventHandlerId] where:
params ["_musicClassname", "_ehId"];
Return Value:
Number - event handler id

Examples

Example 1:
private _ehID = addMusicEventHandler ["MusicStart", { hint str _this }];
Example 2:
private _ehID = addMusicEventHandler ["MusicStop", { hint str _this }];

Additional Information

See also:
removeMusicEventHandler playMusic Arma 3: Event Handlers - Music Event Handlers removeAllMusicEventHandlers getEventHandlerInfo

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
Druid - c
Posted on Mar 04, 2013 - 13:30 (UTC)
There are these two types at this time:
  • MusicStart - It is triggered when the music is started (command playMusic). In variable _this is stored class name from CfgMusic.
  • MusicStop - It is triggered when the music is ended (command playMusic). In variable _this is stored class name from CfgMusic.