Functions

Add dynamic content into your presets

Usage

Format

All functions follow the following format. Arguments can also be wrapped in quotes.

$function(arg1, "arg2")

Most functions can also be nested inside eachother, creating more complex behaviour. This is the main advantage of functions over placeholders.

$uppercase($var("pet_name")) // Cat -> CAT

New functions can also be added with addons using plugin API.

Default Functions

$data(key)

Get data from the current preset file. See how to define data in presets.

# EXAMPLE DATA
data:
    key: 10
    prices:
        sword: 100
        chair: 50
    lines:
    - 'Hello!'
    - 'How are you?'

$hasdata(key)

Same as data, but returns true if given path exists and false if not.


$context(key)

Get a given key from condition context. In order for context to exist, the preset has to have this condition in its conditions. $context(key) can use similar keys to the data function. See which conditions return context. (By default, all conditions also return a condition.<condition> context, which has the result of the condition (true/false) )


$hascontext(key)

Same as $context(key), but returns true if context is set and false if not.


$if(condition, trueText, falseText)

Conditional function, which takes an evaluated statement and depending on the output displays either trueText or falseText.


$var(global, key) $pvar(global, key)

Variable functions allow to retrieve values from variables using a key. $var is used for local variables and $pvar is used for persistent (saved) variables.


$parse(player, text)

Parses the given text for another player, instead of the player viewing the tooltip.


String functions

$static(text)

An important optimization function, which processes and caches the text within. This will stop the given text from being updated and will stay static.


$strip(text)

Strips the given text from all animation tags. Useful when text has to be displayed in another tooltip after an animation was done.


$preprocess(text)

Needed when importing text from elsewhere (for example using a placeholder or a function), which has animations.


Can think of some other useful function? Suggest it in the Discord!

Last updated