Comment on page
Learn how to script with Abilities
With new abilities v2, we've added scripting support for effects. Variables are are reset with server restarts.
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.
Invert a custom variable's boolean. If no variable was set before, it will default to
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.
E.g. if we create a variable:
We can use this variable in effects later like this:
MESSAGE:You are %custom_myVariable%
This would send a message to the player
You are awesome.
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:
MESSAGE:I have %custom_customValue%attacker name%% dollars
This would message
I have 50 dollars
It works the same, but an example would be:
- '%custom_customValue%attacker name%% = 50 %allow%'
If an attempt is made to retrieve a variable which doesn't exist, default value will be
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.
- '%custom_nameof%attacker name%% = 5 : %stop%'
- 'SET_VARIABLE:clicks%attacker name%:<math>%custom_clicks%attacker name%%+1</math>'
- 'MESSAGE:You clicked %custom_clicks%attacker name%% times'