addMusicEventHandler: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "<code>([^ ]*)\[\[([a-zA-Z][a-zA-Z0-9_]+)\]\]([^ ]*)<\/code>" to "<code>$1$2$3</code>")
m (Text replacement - "\|x([0-9])= *<code>([^<]*)<\/code>" to "|x$1= <sqf>$2</sqf>")
Line 23: Line 23:
|r1= [[Number]] - event handler id
|r1= [[Number]] - event handler id


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


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


|seealso= [[setMusicEventHandler]] [[playMusic]] [[removeMusicEventHandler]] [[removeAllMusicEventHandlers]]
|seealso= [[setMusicEventHandler]] [[playMusic]] [[removeMusicEventHandler]] [[removeAllMusicEventHandlers]]

Revision as of 10:21, 13 May 2022

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.
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:
setMusicEventHandler playMusic removeMusicEventHandler removeAllMusicEventHandlers

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.