removeMissionEventHandler: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "|= Game name" to "|Game name=")
(Fix description, add example)
Line 7: Line 7:
____________________________________________________________________________________________
____________________________________________________________________________________________


| Removes mission event handler added by [[addMissionEventHandler]].
| Removes mission event handler added by [[addMissionEventHandler]]. |DESCRIPTION=
When any handler is removed, all handler indices higher that the deleted one should be decremented. |DESCRIPTION=
____________________________________________________________________________________________
____________________________________________________________________________________________


| '''removeMissionEventHandler''' [type, index] |SYNTAX=
| [[removeMissionEventHandler]] [type, index] |SYNTAX=


|p1= type: [[String]]  |PARAMETER1=  
|p1= type: [[String]]  |PARAMETER1=


|p2= index: [[Number]] - Index is returned by addMissionEventHandler. |PARAMETER2=  
|p2= index: [[Number]] - Index is returned by addMissionEventHandler. |PARAMETER2=


| [[Nothing]] |RETURNVALUE=  
| [[Nothing]] |RETURNVALUE=


|x1= <code>[[private]] _eventHandlerId = [[addMissionEventHandler]] ["Ended", { [[diag_log]] "mission complete"; }];
{{cc|...}}
[[removeMissionEventHandler]] ["Ended", _eventHandlerId];</code> |EXAMPLE1=


|x1= <code>
|x2= <code>[[for]] "_i" [[from]] 0 [[to]] 4 [[do]] {
[[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"</code>|EXAMPLE1=  
[[removeMissionEventHandler]] ["Loaded", handler2]; {{cc|Remove the third index under type "Loaded"}}</code>|EXAMPLE2=
 
____________________________________________________________________________________________
____________________________________________________________________________________________


| [[addMissionEventHandler]], [[removeAllMissionEventHandlers]] |SEEALSO=  
| [[addMissionEventHandler]], [[removeAllMissionEventHandlers]] |SEEALSO=


|  |MPBEHAVIOUR=
____________________________________________________________________________________________
}}
}}


Line 38: Line 36:
<!-- Note Section BEGIN -->
<!-- Note Section BEGIN -->


<!-- Note Section END -->
</dl>
<h3 style='display:none'>Bottom Section</h3>
[[Category:Arma_3:_New_Scripting_Commands_List|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
<!-- CONTINUE Notes -->
<dl class="command_description">
<dd class="notedate">Posted on August 6, 2015 - 22:02 (UTC)</dd>
<dd class="notedate">Posted on August 6, 2015 - 22:02 (UTC)</dd>
<dt class="note">[[User:SilentSpike|SilentSpike]]</dt>
<dt class="note">[[User:SilentSpike|SilentSpike]]</dt>
<dd class="note">
<dd class="note">
As of Arma 3 version 1.38 you can safely remove mission event handlers without worrying about decrementing higher indices.
As of Arma 3 version 1.38 you can safely remove mission event handlers without worrying about decrementing higher indices.<br>
'''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) - [[User:Lou Montana|Lou Montana]] ([[User talk:Lou Montana|talk]]) 19:29, 25 June 2020 (CEST)
</dd>
</dd>
<!-- Note Section END -->
</dl>
</dl>
<!-- DISCONTINUE Notes -->
 
<h3 style='display:none'>Bottom Section</h3>

Revision as of 19:29, 25 June 2020

Hover & click on the images for description

Description

Description:
Removes mission event handler added by addMissionEventHandler.
Groups:
Uncategorised

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

See also:
addMissionEventHandlerremoveAllMissionEventHandlers

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)

Bottom Section