removeMissionEventHandler: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "<code>([^<]*)\[\[([a-zA-Z][a-zA-Z0-9_]+)\]\]([^<]*)<\/code>" to "<code>$1$2$3</code>") |
Lou Montana (talk | contribs) m (Text replacement - "<sqf>([^↵][^<]*↵[^<]*)<\/sqf>" to "<sqf> $1 </sqf>") |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 14: | Line 14: | ||
|p1= type: [[String]] | |p1= type: [[String]] | ||
|p2= index: [[Number]] - | |p2= index: [[Number]] - index is returned by addMissionEventHandler. | ||
|r1= [[Nothing]] | |r1= [[Nothing]] | ||
|x1= <sqf>private _eventHandlerId = addMissionEventHandler ["Ended", { diag_log "mission complete"; }]; | |x1= <sqf> | ||
private _eventHandlerId = addMissionEventHandler ["Ended", { diag_log "mission complete"; }]; | |||
// ... | // ... | ||
removeMissionEventHandler ["Ended", _eventHandlerId];</sqf> | removeMissionEventHandler ["Ended", _eventHandlerId]; | ||
</sqf> | |||
|x2= < | |x2= <sqf> | ||
for "_i" from 0 to 4 do { | |||
missionNamespace setVariable [format ["handler%1",_i], addMissionEventHandler ["Loaded","hint ""_i"";"]]; | missionNamespace setVariable [format ["handler%1",_i], addMissionEventHandler ["Loaded","hint ""_i"";"]]; | ||
}; | }; | ||
removeMissionEventHandler ["Loaded", handler2]; // Remove the third index under type "Loaded"</ | removeMissionEventHandler ["Loaded", handler2]; // Remove the third index under type "Loaded" | ||
</sqf> | |||
|x3= <sqf>addMissionEventHandler ["entityKilled",{hint "First kill!"; removeMissionEventHandler ["entityKilled", _thisEventHandler]; }];</sqf> | |||
|seealso= [[addMissionEventHandler]] [[removeAllMissionEventHandlers]] | |seealso= [[addMissionEventHandler]] [[removeAllMissionEventHandlers]] | ||
Line 33: | Line 39: | ||
<dt><dt> | <dt><dt> | ||
<dd class="notedate">Posted on | <dd class="notedate">Posted on 2015-08-06 - 22:02 (UTC)</dd> | ||
<dt class="note">[[User:SilentSpike|SilentSpike]]</dt> | <dt class="note">[[User:SilentSpike|SilentSpike]]</dt> | ||
<dd class="note"> | <dd class="note"> |
Latest revision as of 19:42, 3 September 2024
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"
- Example 3:
- addMissionEventHandler ["entityKilled",{hint "First kill!"; removeMissionEventHandler ["entityKilled", _thisEventHandler]; }];
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 2015-08-06 - 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)