Scripting
Learn how to script with Abilities
With new abilities v2, we've added scripting support for effects. Variables are are reset with server restarts.
SET_VARIABLE:<NAME><VALUE>
SET_VARIABLE:<NAME><VALUE>
Create a custom variable globally, not per user. To create a variable that could be user for a user, you can include user's name in the variable's name, e.g. customVar%attacker name%
INVERT_VARIABLE:<NAME>
INVERT_VARIABLE:<NAME>
Invert a custom variable's boolean. If no variable was set before, it will default to false
Use variable in effects and conditions
Due to nature of these variables and naming, you can create global or per-player variables. To use them in effects and conditions, add a %custom_
prefix and then name your variable.
Global variables
E.g. if we create a variable:
We can use this variable in effects later like this:
This would send a message to the player You are awesome
.
Per-player variables
Creating per-player variables is still as simple and easy! Just include the player name variable inside the variable's name, e.g.:
Then later we can retrieve it in a message like this as well:
This would message I have 50 dollars
Conditions
It works the same, but an example would be:
Null / Unitialized variables
If an attempt is made to retrieve a variable which doesn't exist, default value will be 0
Examples
In this example, we use RIGHT_CLICK trigger to count how many times user right clicks. If they click more than 5 times, they will not be able to activate the message again.
Last updated