> For the complete documentation index, see [llms.txt](https://zypec.gitbook.io/particles/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://zypec.gitbook.io/particles/effects/creating-effect/variables.md).

# Variables

This page was last updated for version v1.2.0

## Description

The most important part of creating an effect with ***TreasureParticles*** is variables, as they allow you to create any desired type of effect. To use variables, it is necessary to first list all variables beforehand. Unlisted variables will result in errors.

When naming your variables, make sure that each variable has a unique name, does not contain special characters, and does not contain spaces. Variable names are case-sensitive.

You can give your variables a default value by adding `name=<VALUE>`. Let's say you want to add a *x* variable and set the value of *x* to 5 by default, you can just add `x=5` to the variables list.&#x20;

## Example

```yml
effects:
  rainbow-circle:
    display-name: "%rainbow-circle%"
    color-animation: "rainbow"
    permission: "%rainbow-effects%"
    variables: [ 'r', 'x', 'y' ]
```

*As seen in the example, we listed and defined the "r", "x", and "y" variables.*

## Pre-defined Variables

Some variables are predefined by the plugin. A variable with the same name as these predefined variables should not be used.

| Variable            | Description                                                      | Aliases |
| ------------------- | ---------------------------------------------------------------- | ------- |
| `i`                 | Loop timer                                                       | \*      |
| `PI`                | 3,14...                                                          | \*      |
| `2PI`               | 2 x PI                                                           | \*      |
| `RANDOM`            | Random decimal between 0 to 1                                    | \*      |
| `RANDOM-`           | Random decimal between -1 to +1                                  | \*      |
| `TICK`              | Game tick                                                        | \*      |
| `currentTimeMillis` | Current time in milliseconds                                     | `CTM`   |
| `lastBoostMillis`   | Last elytra boost time in milliseconds (Paper 1.17+ is required) | `LBM`   |

### Player-related variables

| Variable         | Description                                           | Aliases |
| ---------------- | ----------------------------------------------------- | ------- |
| `isMoving`       | <p>Returns 1 if player is moving, or else 0<br></p>   | \*      |
| `isStanding`     | <p>Returns 1 if player is standing, or else 0<br></p> | \*      |
| `playerYaw`      | Player's yaw (y-rot)                                  | \*      |
| `playerPitch`    | Player's pitch (x-rot)                                | \*      |
| `playerX`        | Player's x location                                   | \*      |
| `playerY`        | Player's y location                                   | \*      |
| `playerZ`        | Player's z location                                   | \*      |
| `velocityX`      | Player's x vector                                     | \*      |
| `velocityY`      | Player's y vector                                     | \*      |
| `velocityZ`      | Player's z vector                                     | \*      |
| `veloticyLength` | Player's vector length                                | \*      |

[*veloticyLength*](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/util/Vector.html#lengthSquared\(\))*: magnitude of the vector squared*
