# Dialogues Properties

## Text lines

This is the message to be sent to the player in each dialogue. Some considerations:

* You can add multiple lines.&#x20;
* You can use PlaceholderAPI variables.&#x20;
* You can use the `%player%` variable to get the player name.
* You can add the `{centered}` variable before the name to make the text centered.
* If you want the player to be able to SKIP the dialogue, just add the `%next%` variable at the end of it. This variable will be replaced with a button players need to click.
* You can use JSON format by writing `"json: <json-message>"`.
* If you want to show the options within the dialogue, use the `%option_X%` variable. More information about this [**HERE**](/interactions/conversation-properties.md#options-in-dialogue).

{% tabs %}
{% tab title="Example 1" %}

```yaml
text:
- "&7Hello &6%player%, &7welcome to the city of"
- "&f&lArgond&7. A magnificent place isn't it?"
```

{% endtab %}

{% tab title="Example 2" %}

```yaml
text:
- "{centered}&7FINALLY you arrived! I was expecting you..."
- "{centered}&7Are you the one everyone is talking about?"
```

{% endtab %}

{% tab title="Example 3" %}

```yaml
text:
- "&7Welcome to the server, would you like to go"
- "&7somewhere? %next%"
```

{% endtab %}

{% tab title="Example 4" %}

```yaml
text:
- 'json: ["",{"text":"Remember to check the ","color":"#AFD6E9"},{"text":"SPAWN","bold":true,"color":"#FF80C0","hoverEvent":{"action":"show_text","contents":[{"text":"Use /spawn to teleport","bold":true,"underlined":true}]}}]'
```

{% endtab %}

{% tab title="Example 5" %}

```yaml
text:
        - '{centered}&8&m000                                                           &8&m000'
        - '{centered}#fffa9c&lHegror'
        - '{centered}#dbdbdbIf I am not wrong, you are &b%player% #dbdbdbright?'
        - ' '
        - '                    %option_1%'
        - '                    %option_2%'
        - '{centered}&8&m000                                                           &8&m000'
```

{% endtab %}
{% endtabs %}

## Time

The time (in seconds) the player has to read the message and continue with the next dialogue.&#x20;

* Set it to 0 if you want the next dialogue to be sent instantly along this dialogue. This is useful for showing a dialogue and options at the same time.
* Set it to -1 if you want the player to click on a button on chat to continue with the dialogue. For this, remember to use the `%next%` option explained above.

```yaml
time: 4
```

## Start Options

When finishing this dialogue, the player options from the conversation defined here, will be displayed.

```yaml
start_options: conversation1
```

## Start Conversation

When finishing this dialogue, the first dialogue from the conversation defined here, will start.

```yaml
start_conversation: conversation4
```

## Actions and Last Actions

At the beginning (or end) of the dialogue you can execute some actions, like giving the player a potion effect or executing a command. You can learn about all actions [CLICKING HERE](/interactions/actions.md).

```yaml
actions:
- "give_potion_effect: BLINDNESS;180;1"
- "give_potion_effect: CONFUSION;180;1"

last_actions:
- "remove_potion_effect: BLINDNESS"
- "remove_potion_effect: CONFUSION"
```

## Show Name

Whether the name of this entity should be displayed on this dialogue.

```yaml
show_name: false
```

## Save Dialogue Option

A very important option for dialogues is the "Save Dialogue" one. In some cases you will want the user to previously have reach to a certain dialogue in a conversation. For example, the first time a player greets a NPC the following dialogue will show: `"Hello citizen, what can I do for you"`.&#x20;

But the next time, another different dialogue will be sent, meaning the player already talked to this NPC. If you want something like this to happen, enable this option. This will save this dialogue for the player and will allow the use of the following PlaceholderAPI variable:&#x20;

`%interactions_has_dialogue_<conversation entity>.<conversation>.<dialogue>%`

This variable will return `true` if the player has reached to that dialogue, and `false` if not.

```yaml
save_dialogue_to_player: true
```

## Conditional Dialogues

A conditional dialogue is a REPLACEMENT for the dialogue and will be sent to the player ONLY if some requirements are met. For example, we have this dialogue: `"Hello adventurer, I hope you are having a great day"`

We can add a conditional dialogue that will replace this dialogue ONLY if the player is lower than level 10. This can be done by adding the next requirement: `"%player_level% < 10"`

![](/files/-MQigpEuhCjHgdtY0s2Y)

We now need to create a conversation with another dialogue, that will replace the original one, and redirect the conditional dialogue to that conversation. In this case I will create a convesation with the dialogue: `"I don't speak to novices"`

In the config it should look something like this:

```yaml
conversation1:
    dialogue:
      dialogue1:
        text:
        - '&7Hello adventurer, I hope you are having a great day'
        time: 2
        conditional_dialogue:
          conditional_dialogue1:
            requires:
            - '%player_level% < 10'
            start_conversation: conversation2
conversation2:
    dialogue:
      dialogue1:
        text:
        - '&7I don't speak to novices'
        time: 2
```

So, as you can see, the conversation will start with the dialogue1 of conversation1, but if the player is lower than level 10, the conversation2 will start instead.

{% hint style="info" %}
You can find more information about Requirements [CLICKING HERE](/interactions/requirements.md).
{% endhint %}

Remember you can use the variable from the Save Dialogue option too! (requires PlaceholderAPI)

```yaml
conversation1:
    dialogue:
      dialogue1:
        text:
        - '&7Hello adventurer, is the first time we met right?'
        time: 2
        save_dialogue_to_player: true
        conditional_dialogue:
          conditional_dialogue1:
            requires:
            - '%interactions_has_dialogue_guard1.conversation1.dialogue1% == true'
            start_conversation: conversation2
conversation2:
    dialogue:
      dialogue1:
        text:
        - '&7Hello again &a%player%'
        time: 2
```

In this case, the first time the player speaks to the NPC, the dialogue1 for the conversation1 will be sent. The next time instead, the conversation2 will start, since the player has already reached the `dialogue1` of `conversation1` from the `guard1.yml` file.

You can also redirect to another conversation options instead of a dialogue using:

```yaml
start_options: <conversation>
```

{% hint style="info" %}
Remember, you can add multiple conditional dialogues. If the conditions for one dialogue are not met, then it will check for the next one. If the requirements are not met for ANY of the conditional dialogues, then the original dialogue will be sent.
{% endhint %}


---

# 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://ajneb97.gitbook.io/interactions/dialogues-properties.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.
