# Commands

Actions support some custom commands. Note that these are not actual commands that can be executed in chat and they only work inside actions.



## Commands

Regular

* [**sound**](#sound) - send a sound to a player
* [**message**](#message) - send a message to a player
* [**delay**](#delay) - send multiple commands to player after a delay

**Variables**

* [**setvar**](#setvar) - set a global or player variable
* [**setpersistentvar**](#setpersistentvar) - set a global or player persistent variable
* [**clearvar**](#clearvar) - clear a global or player variable
* [**clearpersistentvar**](#clearpersistentvar) - clear a global or player persistent variable
* [**clearvars**](#clearvars) - clear all global or player variables
* [**clearpersistentvars**](#clearpersistentvars) - clear all global or player persistent variables
* [**savepersistentvars**](#savepersistentvars) - save all persistent variables to the file

#### Animations

* skip - skip animations





## Regular

### sound

Send a sound to the player viewing the tooltip.

> **Arguments**
>
> 1. sound name
>    * used exactly the same way as in the /playsound command.
>    * list of vanilla sounds can be found [here](https://www.digminecraft.com/lists/sound_list_pc.php)
> 2. sound category
>    * used exactly the same way as in the /playsound command.
>    * list of sound categories can be found [here](https://www.digminecraft.com/lists/sound_list_pc.php) (on the right)
> 3. volume (float)
> 4. pitch (float)

**Examples**

```yaml
actions:
  on-show:
  - sound minecraft:block.amethyst_block.break master 1 1
  right-click:
  - sound custom:mysoundname master 1 1
```

### message

Send a message to the player viewing the tooltip. Supports hex, PAPI placeholders and [local placeholders](../../../extra/local-placeholders).

> **Arguments**
>
> Message

**Examples**

```yaml
actions:
  on-show:
  - message Welcome traveller!
  left-click:
  - message &cOuch!
```

### delay

Send an array of commands to the player viewing the tooltip after a specific given delay. Commands are separated with a `;` and support both local commands (on this page) and outside commands. Supports all placeholders.

> **Arguments**
>
> Time (ticks, 1 second = 20 minecraft ticks)
>
> Commands (separated with a ; )

**Examples**

```yaml
actions:
  on-stop-showing:
  # After 1 second, message hello and kill the player
  - delay 20 message Hello!; kill %player%
  # After 5 seconds, set variable meow to false
  - delay 100 setvar player meow false
```

## Variables

### setvar

Set a [non-persistent](../../../../extra/variables#persistence) variable for the given [player or globally](../../../../extra/variables#scope). Supports PAPI placeholders and [local placeholders](../../../extra/local-placeholders).

> **Arguments**
>
> [Scope](../../../../extra/variables#scope) \[ player / global / insert players name ]
>
> Variable name (supports placeholders)
>
> Value ([supports mathematical evaluation](../../../../extra/variables#evaluation))

**Examples**

```yaml
actions:
  on-stop-showing:
  # Scope here is global,
  # variable name is meow 
  # and value is 1
  - setvar global meow 1
```

### setpersistentvar

Set a [persistent](../../../../extra/variables#persistence) variable for the given player or globally. Supports PAPI placeholders and [local placeholders](../../../extra/local-placeholders).

> **Arguments**
>
> Scope \[ player / global / insert players name ]
>
> Variable name (supports placeholders)
>
> Value (supports mathematical evaluation)

**Examples**

```yaml
actions:
  on-stop-showing:
  # Add 1 for each time the player looks at this tooltip
  - setpersistentvar player looked %persistentvar_looked% + 1
```

### clearvar

Clear a [non-persistent](../../../../extra/variables#persistence) variable for the given player or globally. Supports PAPI placeholders and [local placeholders](../../../extra/local-placeholders).

> **Arguments**
>
> [Scope](../../../../extra/variables#scope) \[ player / global / insert players name ]
>
> Variable name (supports placeholders)

**Examples**

```yaml
actions:
  on-stop-showing:
  # Clears the "meow" variable, effectively removing it
  - clearvar player meow 
```

### clearpersistentvar

Clear a [persistent](../../../../extra/variables#persistence) variable for the given player or globally. Supports PAPI placeholders and [local placeholders](../../../extra/local-placeholders).

> **Arguments**
>
> [Scope](../../../../extra/variables#scope) \[ player / global / insert players name ]
>
> Variable name (supports placeholders)

**Examples**

```yaml
actions:
  on-stop-showing:
  # Clears the "meow" variable, effectively removing it
  - clearpersistentvar player looked 
```

### clearvars

Clear all [non-persistent](../../../../extra/variables#persistence) variables for either a given player or globally.

> **Arguments**
>
> [Scope](../../../../extra/variables#scope) \[ player / global / insert players name ]

**Examples**

```yaml
actions:
  on-stop-showing:
  # Clear all global variables
  - clearvars global
  # Clear all players variables
  - clearvars player
```

### clearpersistentvars

Clear all [persistent](../../../../extra/variables#persistence) variables for either a given player or globally.

> **Arguments**
>
> [Scope](../../../../extra/variables#scope) \[ player / global / insert players name ]

**Examples**

```yaml
actions:
  on-stop-showing:
  # Clear all persistent global variables
  - clearpersistentvars global
  # Clear all persistent players variables
  - clearpersistentvars player
```

### savepersistentvars

Save all [persistent](../../../../extra/variables#persistence) variables.



**Examples**

```yaml
actions:
  on-stop-showing:
  - savepersistentvars
```



## Animations

### skip

Skips animations depending on given arguments. **Note that the animations have to have an ID  to be able to be skipped**.

> **Arguments**
>
> Skipped \[ current / all ]

#### Examples

```
actions:
    left-click:
    # Skips the current running animation
    - skip current
    # Skips ALL animations in the preset
    - skip all
```









