addMusicEventHandler: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
Line 7: Line 7:
____________________________________________________________________________________________
____________________________________________________________________________________________


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


Line 14: Line 14:
|p1= [type, function]: [[Array]]  |= PARAMETER1  
|p1= [type, function]: [[Array]]  |= PARAMETER1  


|p2= type: [[String]] |= PARAMETER2
|p2= type: [[String]] - "MusicStart" or "MusicStop" |= PARAMETER2


|p3= function: [[String]] or [[Code]]  |= PARAMETER3  
|p3= function: [[String]] or [[Code]]. Passed params array 0: [[Description.ext#Music|CfgMusic]] class name, 1: event handler id |= PARAMETER3  


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




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


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


| |= SEEALSO  
| [[setMusicEventHandler]], [[playMusic]], [[removeMusicEventHandler]], [[removeAllMusicEventHandlers]] |= SEEALSO  


|  |= MPBEHAVIOUR  
|  |= MPBEHAVIOUR  
Line 37: Line 38:
<dd class="notedate">Posted on March 4, 2013 - 13:30
<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/>
<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/>
'''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 CfgMusic.<br/><br/>
'''MusicStop''' - It is triggered when the music is ended (command playMusic). In variable _this is stored class name from [[Description.ext#Music|CfgMusic]].
There is no return value in Arma 3 version 0.50, will be fixed ASAP.


<!-- Note Section END -->
<!-- Note Section END -->

Revision as of 22:19, 15 December 2013

Hover & click on the images for description

Description

Description:
Add music track event handler. Returns id of the handler or -1 when failed.
Groups:
Uncategorised

Syntax

Syntax:
addMusicEventHandler [type, function]
Parameters:
[type, function]: Array
type: String - "MusicStart" or "MusicStop"
function: String or Code. Passed params array 0: CfgMusic class name, 1: event handler id
Return Value:
Number - event handler id

Examples

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

Additional Information

See also:
setMusicEventHandlerplayMusicremoveMusicEventHandlerremoveAllMusicEventHandlers

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

Notes

Posted on March 4, 2013 - 13:30
Druid
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.

Bottom Section