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

# Variables Tutorial

Each of the variables in the config follows a certain format. Here you can find the explanation of the options you can use. Everytime you modify something in this file you must reload the plugin using `/svar reload`

## Variable Type

Type of the variable. You can use PLAYER or GLOBAL.

* GLOBAL: The variable is set for the whole server.
* PLAYER: The variable is set for a player in particular.

```yaml
variable_type: GLOBAL
```

## Value Type

Value format of the variable. You can use TEXT, INTEGER or DOUBLE.

* TEXT: The variable accepts all values.
* INTEGER: The variable accepts only numbers.
* DOUBLE: The variable accepts numbers with decimals.
* LIST: The variable will consist of a list of values.

{% hint style="warning" %}
If you want to use the add/reduce commands you must set this option to INTEGER or DOUBLE.
{% endhint %}

```yaml
value_type: TEXT
```

## Initial Value

The initial or default value of the variable.

```yaml
# For TEXT
initial_value: "off"

# For INTEGER
initial_value: 500

# For LIST
initial_value: [] # empty list
initial_value:
- element0
- element1
- element2
```

## Possible Values

The possible values of this variable. You'll not be able to set the variable to a different value. Format: `<value>;(optional)<display>`

The "display" is optional and it is a visual representation of the variable which can be used as a PlaceholderAPI variable. Always use a single word for the value option, if you need multiple words, use something like this: "this\_is\_the\_first\_value".

```yaml
possible_values:
- "off;&c&lPortal Disabled"
- "on;&a&lPortal Enabled"

possible_values:
- "1"
- "2"
- "3"
```

{% hint style="info" %}
This parameter is completely optional.
{% endhint %}

## Limitations

Conditions that the variable will have. You will not be able to change the variable if the new value doesn't respect these conditions.

### Min Value

Minimum value of the variable. Only works with [Value Type](#value-type) on INTEGER or DOUBLE.&#x20;

```yaml
limitations:
  min_value: 0
```

### Max Value

Maximum value of the variable. Only works with [Value Type](#value-type) on INTEGER or DOUBLE.&#x20;

```yaml
limitations:
  max_value: 100
```

### Manage Out of Range

If this option is set to true, when changing the variable's value, to something that is outside the max/min limits, the out of range error will disappear, and instead, the limit will be used as the new value.

```yaml
limitations:
  manage_out_of_range: true
```

```yaml
# Example 1
# /svar set test_variable 1500
# This command will throw an error, because the max value is 1000.
limitations:
  max_value: 1000
  
# Example 2
# /svar set test_variable 1500
# manage_out_of_range is set to true, so this command will set the value to 1000 (the max value).
limitations:
  max_value: 1000
  manage_out_of_range: true
```

### Max Characters

Maximum number of characters of the variable. Only works with [Value Type](/servervariables/variables-tutorial.md#value-type) on TEXT.

```yaml
limitations:
  max_characters: 10
```

### Max Decimals

Maximum number of decimals. Only works with [Value Type](#value-type) on DOUBLE.&#x20;

{% hint style="info" %}
In contrast to the previous options, this is not really a limitation, but a transformation, which means the final value of the variable will always have a maximum of X decimals, even if you used many more decimals on the command to modify its value.
{% endhint %}

```yaml
limitations:
  max_decimals: 3
```
