# event\_clear

### Function

> event\_clear

### Syntax

> event\_clear( EventId );

### Parameters

**\[Expression (EventId)]**

Event ID of the event that needs to be deactivated.

### Description

Clears an event by its Event ID.

### Examples

`event_clear(1);`

Clear an event with `EventId = 1`.

When an event is executed, the `$event_id` pseudo-register contains the target event's ID.

For example, you can force an event to be cleared immediately:

```
!epthook nt!ExAllocatePoolWithTag script {
 event_clear($event_id);
}
```

The above example, won't guarantee that only one event will be executed, as multiple cores might reach to the above code simultaneously. If you want to avoid multiple runs, you can use [interlocked](https://docs.hyperdbg.org/commands/scripting-language/functions/interlocked) functions.

### Remarks

You can see events' ID using the [event](https://docs.hyperdbg.org/commands/debugging-commands/events) command. The first column of [this command](https://docs.hyperdbg.org/commands/debugging-commands/events)'s results shows the event ID.

Like the '[events](https://docs.hyperdbg.org/commands/scripting-language/functions/events)' command, using this function won't immediately remove the event effect on the system, instead, it **disables** the event and once the system is continued, the event will be **cleared**.

Starting from **v0.7**, this function is added to HyperDbg as a result of implementing the [instant event](https://docs.hyperdbg.org/tips-and-tricks/misc/instant-events) mechanism.

### Related

[event\_enable](https://docs.hyperdbg.org/commands/scripting-language/functions/events/event_enable)

[event\_disable](https://docs.hyperdbg.org/commands/scripting-language/functions/events/event_disable)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hyperdbg.org/commands/scripting-language/functions/events/event_clear.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
