Functions
Add dynamic content into your presets
Usage
Format
All functions follow the following format. Arguments can also be wrapped in quotes.
Most functions can also be nested inside eachother, creating more complex behaviour. This is the main advantage of functions over placeholders.
New functions can also be added with addons using plugin API.
Default Functions
⭐ $data(key)
$data(key)
Get data from the current preset file. See how to define data in presets.
$hasdata(key)
$hasdata(key)
Same as data, but returns true if given path exists and false if not.
⭐ $context(key)
$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 acondition.<condition>
context, which has the result of the condition (true/false) )
$hascontext(key)
$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)
$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)
$parse(player, text)
Parses the given text for another player, instead of the player viewing the tooltip.
String functions
⭐ $static(text)
$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)
$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