RemoveEventHandler
A function added by the New Vegas Script Extender.
Contents
Description
Removes the specified script as an event handler for the specified event.
Two optional filter arguments can be supplied as key::value pairs to filter events according to the target and/or object.
If both filters are omitted, all event handlers matching the script and event will be removed. If only one filter is omitted, all handlers matching the script, event, and the other filter will be removed.
An optional priority argument can be supplied as "priority"::value. More information is in the Priority System section.
Returns true if at least one matching event handler was found and removed, false otherwise.
Syntax
(Removed:bool) RemoveEventHandler eventID:string FunctionScript:ref Filter1:pair Filter2:pair Priority:pair{"priority"::0}
Priority System (New in xNVSE 6.2.9)
If unspecified, default priority while removing an event is 0, which is reserved as an invalid priority (meaning we don't want to filter by any priority). So by default, priority is ignored and all handlers with matching filters will get removed.
For more details, see Event Handler Priority System.
Examples
Say there was an event handler registered with priority = 2:
SetEventHandler "SomeEvent" SomeUDF "priority"::2
To remove this handler, we could use:
RemoveEventHandler "SomeEvent" SomeUDF
This would remove all handlers with SomeUDF, regardless of priority
We could also use:
RemoveEventHandler "SomeEvent" SomeUDF "priority"::2
This would only remove all handlers with SomeUDF that have priority = 2.
The priority arg can be swapped around with the filter args. For example, these lines do the same thing:
RemoveEventHandler "SomeEvent" SomeUDF "priority"::2 "first"::Player RemoveEventHandler "SomeEvent" SomeUDF "first"::Player "priority"::2