addMusicEventHandler: Difference between revisions
Jump to navigation
Jump to search
m (Updated formatting of parameters to be consistent) |
Lou Montana (talk | contribs) m (Some wiki formatting) |
||
Line 3: | Line 3: | ||
|game1= arma3 | |game1= arma3 | ||
|version1= 0.50 | |version1= 0.50 | ||
|eff= local | |||
|gr1= Event Handlers | |gr1= Event Handlers | ||
Line 8: | Line 10: | ||
|gr2= Sounds | |gr2= Sounds | ||
|descr= Adds [[playMusic]] event handler. Returns id of the handler or -1 when failed. | |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. | ||
|s1= [[addMusicEventHandler]] [type, function] | |s1= [[addMusicEventHandler]] [type, function] | ||
|p1= | |p1= type: [[String]] - "MusicStart" or "MusicStop" | ||
|p2= | |p2= function: [[String]] or [[Code]] - passed params array is [musicClassname, eventHandlerId] where: | ||
* musicClassname: [[String]] - [[Description.ext#Music|CfgMusic]] class name | |||
* eventHandlerId: [[Number]] - event handler id | |||
<syntaxhighlight lang="cpp">params ["_musicClassname", "_ehId"];</syntaxhighlight> | |||
| | |r1= [[Number]] - event handler id | ||
| | |x1= <code>[[private]] _ehID = [[addMusicEventHandler]] ["MusicStart", { [[hint]] [[str]] _this }];</code> | ||
| | |x2= <code>[[private]] _ehID = [[addMusicEventHandler]] ["MusicStop", { [[hint]] [[str]] _this }];</code> | ||
|seealso= [[setMusicEventHandler]], [[playMusic]], [[removeMusicEventHandler]], [[removeAllMusicEventHandlers]] | |seealso= [[setMusicEventHandler]], [[playMusic]], [[removeMusicEventHandler]], [[removeAllMusicEventHandlers]] | ||
}} | }} | ||
{{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]]. | |||
'''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]]. | |||
Revision as of 14:45, 24 November 2021
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
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
- Posted on Mar 04, 2013 - 13:30 (UTC)
- There are these two types at this time: