> For the complete documentation index, see [llms.txt](https://customentity.gitbook.io/nexus/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://customentity.gitbook.io/nexus/script-system/tutorial.md).

# Tutorial

To add an action in the phase of a nexus you have to execute the following command:

```
/nexus phase <nexus> action add <phase>
```

Once the command is executed, you will be in action creation mode, you just have to write your script in the chat.

{% hint style="info" %}
If your script is too big for your chat, you can simply put at the end "**`|`"** to not validate the script.

You can also quit the action creation mode by writing "`cancel`" in the chat or re-run the command.
{% endhint %}

At the moment, there are three types of actions: **Wait Action**, **Defend Action** and **Attack Action.**

### Wait Action:

As you know, the nexus performs actions every second. Well with this action you can make the nexus perform the next action after a few seconds.

You simply have to follow this syntax:

```sql
wait X second(s)
```

### Defend Action:

This action allows you to cast a defense spell following this syntax:

```sql
defend nexus with 'Susanoo'
```

{% hint style="info" %}
You can also use double quotes to specify a character string.
{% endhint %}

You can also add properties by following this syntax:

```sql
defend nexus with 'Susanoo' and property 'duration' = 20, 'test' = 2
```

### Attack Action:

The attack action is a bit more complex than the defense action because you can specify several targeting parameters.

```sql
attack [the %COUNT%] [nearest | furthest] players [in a radius of X blocks] with 'Drainlife' [and property 'heart' = 2, 'heartToHealth' = 5]
```

{% hint style="info" %}
\[ ] = Optional Parameters

**|** = OR
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://customentity.gitbook.io/nexus/script-system/tutorial.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.
