# OnAddCommands

The **OnAddCommands** event is called to allow your [script add-in](https://chaoses-ib.gitbook.io/directory-opus/manual/scripting/script_add-ins) to [add internal commands](https://chaoses-ib.gitbook.io/directory-opus/manual/scripting/example_scripts/adding_a_new_internal_command). Call the [**AddCmdData**](https://chaoses-ib.gitbook.io/directory-opus/manual/reference/scripting_reference/scripting_objects/addcmddata)**.AddCommand** method once for each command you wish to add.

| **Method Name:**   | OnAddCommands                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Argument Type:** | [**AddCmdData**](https://chaoses-ib.gitbook.io/directory-opus/manual/reference/scripting_reference/scripting_objects/addcmddata)                                                                                                                                                                                                                                                                                                                                                                                                   |
| **Return Type:**   | *none*                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| **Description:**   | When Opus starts up, or when a script add-in is added, edited or enabled, its **OnAddCommands** method is called. This allows a script to [add internal commands](https://chaoses-ib.gitbook.io/directory-opus/manual/scripting/example_scripts/adding_a_new_internal_command)to the Opus command set. A script can reinitialize its list of commands at any time by calling the [**Script**](https://chaoses-ib.gitbook.io/directory-opus/manual/reference/scripting_reference/scripting_objects/script)**.InitCommands** method. |


---

# 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://chaoses-ib.gitbook.io/directory-opus/manual/reference/scripting_reference/scripting_events/onaddcommands.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.
