addMusicEventHandler: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(Add 2.18 info)
m (fix typo)
 
(One intermediate revision by one other user not shown)
Line 18: Line 18:


|p2= function: [[String]] or [[Code]] - passed params array is [musicClassname, eventHandlerId] where:
|p2= function: [[String]] or [[Code]] - passed params array is [musicClassname, eventHandlerId] where:
<sqf>params ["_musicClassname", "_eventHandlerId", "_currentPosition", "_toralLength"];</sqf>
<sqf>params ["_musicClassname", "_eventHandlerId", "_currentPosition", "_totalLength"];</sqf>
* musicClassName: [[String]] - [[Description.ext#Music|CfgMusic]] class name of the music that started
* musicClassName: [[String]] - [[Description.ext#Music|CfgMusic]] class name of the music that started
* eventHandlerId: [[Number]] - event handler id (same as returned by [[addMusicEventHandler]] usage)
* eventHandlerId: [[Number]] - event handler id (same as returned by [[addMusicEventHandler]] usage)

Latest revision as of 13:01, 6 November 2024

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", "_eventHandlerId", "_currentPosition", "_totalLength"];
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.