# Preset

## Configuration

Presets are configured in the `Tooltips/presets` folder. To create presets, create a new file in the folder as `<name>.yml`. After that, you can start configuring presets in that file.

### Configuration

All of these, except for `theme` are optional.

```yaml
preset-id:
  priority: 0
  text:
  - 'Test Tooltip'
  - 'Price: 500{default/gem}'
  - '(Click to buy)'
  fade:
    fadein: 20
    stay: 20
    fadeout: 20
  theme: default/three-line
  display:
    color: white
    horizontal-shift: 0
  conditions:
  - gamemode{gm=creative} true
  show:
    reshow: false
    active: true
    cooldown: 0
  actions:
    right-click:
    - 'message Hello!'
  
```

### Minimal Configuration

```yaml
preset-id:
  theme: default-three-line
```

### Properties

`priority` - Highest priority will appear first

Default priority for all presets is 0. \
Presets with a higher priority will be checked first, this is extremely useful in more complex configurations with multiple presets.

#### `text` - Lines of text that will be displayed

```yaml
text:
- 'Regular text, nothing special' # PlaceholderAPI placeholder supported
- '||Centered text||' # Centered text
- '<red>Colored <gradient:red:blue>text' # MiniMessage format
- 'Sofa price: <green>$data(furniture.sofa.price)$' # Functions
- '<typewriter text="Hello there!">' # Animations
```

<div align="left"><figure><img src="/files/bgnq3SPdN2bgph9evaWY" alt="" width="332"><figcaption></figcaption></figure></div>

#### `fade` - Fade options, just like in titles

```yaml
fade:
    fadein: 20 # 20 ticks = 1 second to fade in
    stay: 100 # 100 ticks to stay, only necessary with active: false
    fadeout: 40 # 40 ticks = 2 seconds to fade out
```

<div align="left"><figure><img src="/files/N2Ti6nnhQEYTfz7DW0Cr" alt=""><figcaption></figcaption></figure></div>

#### `theme` - The visual theme used for this preset

Set to the ID of a [Theme](/tooltips/configuration/theme.md). This is required, otherwise preset wouldn't know what to look like.

#### `display`

Options related to how the tooltip is displayed.

> **`color` - color of the background**
>
> You can specify the color the following ways:

{% hint style="warning" %}
**Gradients generate a larger JSON message than regular color, so tooltips with gradients that have a large background may be laggier!**
{% endhint %}

```yaml
color: 'white'
color: '#fcba03'
color: 'red:green' # gradient from red to green
color: '#ffffff:#00ff19' # gradient from #ffffff to #00ff19
color: '#ffffff:#00ff19:#ffffff' # gradient from #ffffff to #00ff19 and to #ffffff again 
```

<div align="left"><figure><img src="/files/HdimVRtHpAraAwNUGVqy" alt="" width="346"><figcaption><p>color: "#ffffff-#ff0000-#ffffff"</p></figcaption></figure></div>

> `horizontal-shift` - shift of the tooltip in pixels

<table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td>horizontal-shift: 10</td><td></td><td></td><td><a href="/files/JobXIevxolhkuLh1bnph">/files/JobXIevxolhkuLh1bnph</a></td></tr><tr><td>horizontal-shift: -10</td><td></td><td></td><td><a href="/files/NRZ4P6o3eY3hb6WRQtHu">/files/NRZ4P6o3eY3hb6WRQtHu</a></td></tr></tbody></table>

#### `conditions` - a list of conditions

Conditions, which have to be fulfilled in often for this preset to be shown. More about conditions:

{% content-ref url="/pages/vNMKF1v7jeVUve2ylZxq" %}
[Conditions](/tooltips/configuration/preset/conditions.md)
{% endcontent-ref %}

#### `show` - defines how this preset is shown

Presets can be made to be shown once or have a given cooldown. More about show properties:

{% content-ref url="/pages/VR88d8jv2EZui15A83rR" %}
[Show](/tooltips/configuration/preset/show.md)
{% endcontent-ref %}

#### `actions` - commands tied to actions

Think of this as events, once they happen - a list of commands is ran. More about actions:

{% content-ref url="/pages/a9mVZX7w8upQNfjPms4R" %}
[Actions](/tooltips/configuration/preset/actions.md)
{% endcontent-ref %}

## Other Properties

### File Priority

You can define a priority for the entire preset file like so:

```yaml
priority: 10 # At the top of the file

my-preset:
    ...
my-other-preset:
    ...
```

This will add the given priority priorities of all presets. For example if `my-presets` priority is 0, it will be 10 with the file priority. This option is useful to make presets of one file more important than of another file.

### Data

Data is scoped to a single preset file, and can be used by the `$data(key)` function in presets. This is useful to have predefined data, like furniture prices right in your preset files. You can define any sort of valid yaml data after "`data`".

```yaml
data: # At the top of the file
    my-own-key: 1
    debug: true
    prices:
        chair: 100
        table: 50
    lines:
    - 'Hello!'
    - 'My name is %placeholder%'
```

### Parenting

Presets support parenting since plugin version 1.5. Parenting allows you to copy all properties from a "parent" preset into another preset and modify only the required properties. Parents and children are defined like so:

```yaml
parent:
  content:
    text:
    - '&cThe parent!'
  display:
    theme: default-one-line

child:
  parent: parent
  
child-modified:
  parent: parent
  content:
    text:
    - '&aThe second child!'
```

Other children can be parented as well.


---

# 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://tooltips.gitbook.io/tooltips/configuration/preset.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.
