Events
Last updated
Was this helpful?
Last updated
Was this helpful?
local
Specifying that an event is local
makes the event only usable from within the script that it is defined in. This allows you to create events that do not interfere with events from other addons or scripts.
The string used in the trigger line represents the identifier of this custom event. This identifier should be used for .
event-values
The event-values specified here will be available in the event, either as a default expression (message "Hello"
without the need for to player
) or as a normal event-value (event-player
/ player
)
parse
Code in this section is executed whenever the event is parsed. This section may be used to emit errors if the effect is used in an improper context.
check
Code in this section is executed just before the event is called. This section may be used to stop the event from being called if certain conditions are met.
You can get an instance of a custom event using the following expression:
You can then call it using the following effect:
If you want to check if an event has been cancelled, after you've called it, you can use the following condition:
In the syntax above, %string%
is the index. This doesn't have to be plural, but can be.
If this section is included, you must also if the event was parsed successfully.
If this section is included, you must also if you want to event to be called.
The first argument should contain the name of the event you want to call. The second argument is a list variable, with each element of the following format: {list::%type%} = %value%
. The third argument is almost the same, the only difference is that %type%
is replaced with a string, which is just the index. The first list variable is for , while the second is for .
If the event-values aren't enough for your desire, you can make use of the extra data feature. The syntax for adding event-values to a custom event is explained in , and how to call an event with them is explained in In the event itself, you can get the extra data with the data expression:
It may look fancier to create a custom expression instead of using extra data. To do so, you need to call event.getData(%string%)
to get the data value. See the usable in
sections in , and .