addMusicEventHandler: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
(Add EH link)
 
(53 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


| arma3 |= Game name
|game1= arma3
|version1= 0.50


|0.50|= Game version
|eff= local
____________________________________________________________________________________________


| Add an music track event handler. Returns id of the handler or -1 when failed.  |= Description
|gr1= Event Handlers
____________________________________________________________________________________________


| '''addMusicEventHandler''' [type, function] |= Syntax
|gr2= Sounds


|p1= [type, function]: [[Array]] |= PARAMETER1
|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}}.


|p2= type: [[String]] |= PARAMETER2
|s1= [[addMusicEventHandler]] [type, function]


|p3= function: [[String]] or [[Code]]  |= PARAMETER3
|p1= type: [[String]] - "MusicStart" or "MusicStop"


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


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


|x1= <code>addMusicEventHandler ["MusicStart", "hint format['Sample %1 start', _this select 0]"]</code>|= EXAMPLE1
|x1= <sqf>private _ehID = addMusicEventHandler ["MusicStart", { hint str _this }];</sqf>


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


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


| |= MPBEHAVIOUR
{{Note
____________________________________________________________________________________________
|user= Druid
|timestamp= 20130304133000
|text= 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 [[Description.ext#Music|CfgMusic]].
* '''MusicStop''' - It is triggered when the music is ended (command [[playMusic]]). In variable _this is stored class name from [[Description.ext#Music|CfgMusic]].
}}
}}
<h3 style='display:none'>Notes</h3>
<dl class='command_description'>
<!-- Note Section BEGIN -->
<dd class="notedate">Posted on March 4, 2013 - 13:30
<dt class="note">'''[[User:Druid|Druid]]'''<dd class="note">There are these two types at this time:<br/>
'''MusicStart''' - It is triggered when the music is started (command playMusic). In variable _this is stored class name from CfgMusic.<br/>
'''MusicStop''' - It is triggered when the music is ended (command playMusic). In variable _this is stored class name from CfgMusic.<br/><br/>
There is no return value in Arma 3 version 0.50, will be fixed ASAP.
<!-- Note Section END -->
</dl>
<h3 style='display:none'>Bottom Section</h3>
[[Category:Arma_3:_New_Scripting_Commands_List|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]

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.