removeMissionEventHandler: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "_{10,} " to "") |
Lou Montana (talk | contribs) m (Text replacement - " *\| *([Cc]omments|COMMENTS|Game|[Gg]ame [Nn]ame|Game [Vv]ersion|Game Version \(number surrounded by NO SPACES\)|Multiplayer Arguments( \("local" or "global"\))?|Effects|Multiplayer Effects( \("local" or "global"\))?|Multiplayer Exe...) |
||
Line 1: | Line 1: | ||
{{Command | {{Command | ||
| arma3 | | arma3 | ||
|0.50 | |0.50 | ||
|eff= local |MP Effects= | |eff= local |MP Effects= | ||
|gr1= Event Handlers | |gr1= Event Handlers | ||
| Removes mission event handler added by [[addMissionEventHandler]]. | | Removes mission event handler added by [[addMissionEventHandler]]. | ||
| [[removeMissionEventHandler]] [type, index] | | [[removeMissionEventHandler]] [type, index] | ||
|p1= type: [[String]] | |p1= type: [[String]] | ||
|p2= index: [[Number]] - Index is returned by addMissionEventHandler. | |p2= index: [[Number]] - Index is returned by addMissionEventHandler. | ||
| [[Nothing]] | | [[Nothing]] | ||
|x1= <code>[[private]] _eventHandlerId = [[addMissionEventHandler]] ["Ended", { [[diag_log]] "mission complete"; }]; | |x1= <code>[[private]] _eventHandlerId = [[addMissionEventHandler]] ["Ended", { [[diag_log]] "mission complete"; }]; | ||
{{cc|...}} | {{cc|...}} | ||
[[removeMissionEventHandler]] ["Ended", _eventHandlerId];</code> | [[removeMissionEventHandler]] ["Ended", _eventHandlerId];</code> | ||
|x2= <code>[[for]] "_i" [[from]] 0 [[to]] 4 [[do]] { | |x2= <code>[[for]] "_i" [[from]] 0 [[to]] 4 [[do]] { | ||
[[missionNamespace]] [[setVariable]] [<nowiki/>[[format]] ["handler%1",_i], [[addMissionEventHandler]] ["Loaded","hint ""_i"";"]]; | [[missionNamespace]] [[setVariable]] [<nowiki/>[[format]] ["handler%1",_i], [[addMissionEventHandler]] ["Loaded","hint ""_i"";"]]; | ||
}; | }; | ||
[[removeMissionEventHandler]] ["Loaded", handler2]; {{cc|Remove the third index under type "Loaded"}}</code> | [[removeMissionEventHandler]] ["Loaded", handler2]; {{cc|Remove the third index under type "Loaded"}}</code> | ||
| [[addMissionEventHandler]], [[removeAllMissionEventHandlers]] | | [[addMissionEventHandler]], [[removeAllMissionEventHandlers]] | ||
}} | }} |
Revision as of 01:27, 18 January 2021
Description
- Description:
- Removes mission event handler added by addMissionEventHandler.
- Groups:
- Event Handlers
Syntax
- Syntax:
- removeMissionEventHandler [type, index]
- Parameters:
- type: String
- index: Number - Index is returned by addMissionEventHandler.
- Return Value:
- Nothing
Examples
- Example 1:
private _eventHandlerId = addMissionEventHandler ["Ended", { diag_log "mission complete"; }]; // ... removeMissionEventHandler ["Ended", _eventHandlerId];
- Example 2:
for "_i" from 0 to 4 do { missionNamespace setVariable [format ["handler%1",_i], addMissionEventHandler ["Loaded","hint ""_i"";"]]; }; removeMissionEventHandler ["Loaded", handler2]; // Remove the third index under type "Loaded"
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
Notes
- Posted on August 6, 2015 - 22:02 (UTC)
- SilentSpike
-
As of Arma 3 version 1.38 you can safely remove mission event handlers without worrying about decrementing higher indices.
EDIT: this command used to decrement other EH ids above the deleted one (e.g EH 0,1,2,3, delete EH 1, EH would be 0,1,2 now and not 0,2,3) - Lou Montana (talk) 19:29, 25 June 2020 (CEST)