Allows users to perform any action you want by using customizable gestures. Uses custom events for maximum customizability.
This script requires
Skript (obviously),
SkBee (for the particles), and
skript-reflect for most of the other stuff. It was coded using
2.8.0,
3.1.0 and
2.4 respectively.
Credit to
@danny19990 on Discord who helped with the initial idea for this.
What is a gesture sequence?
- A gesture sequence is any number of directions the user can move their cursor. The options are up, down, left, and right.
- As an example, registering a gesture could be down using /gesture add up down - this would create an event (which can be used in any script) which would fire whenever the user performs the up down gesture.
On gesture event:
- A custom event is registered which follows the syntax syntax gesture [[of] %gesture sequence%], which, for example, would accept any of the following as valid syntaxes for the gesture sequence of up down:
- on gesture of up down
- on gesture up down
- on gesture:
- if event-gesture is "up down":
- The event will throw an error on reload if an unregistered gesture is used in a script file. For example, if a script contains on gesture of up down: as an event, but up down isn't a registered gesture, it will error.
- The event currently has 2 event-values: player and gesture.
- Having the player means that you can use, for example, the send effect, or pass said player to a function. It is referred to in the same way as any other event.
- The gesture event-value is a new addition with the gesture system, which can only be used in the on gesture event. It can be called using the syntax [event[-| ]]gesture, which means event-gesture, event gesture and gesture are all valid. It simply returns, as a string, the gesture (e.g. for gesture up down, it would return "up down")
To register a gesture:
- Use command /gestures add (gesture sequence)
- The added gesture sequence should now be usable in the on gesture event.
- This requires the gestures.admin permission
To deregister a gesture:
- Use command /gestures remove (gesture sequence)
- If the removed gesture sequence was being used in an event, it will no longer execute that code, and on the next reload of the script will throw an error.
- This requires the gestures.admin permission
To list the registered gestures:
- Use command /gestures list
- This requires the gestures.admin permission
Things that might be added soon:
- Maybe more event-values (if I can properly figure out how the custom events work)
For a video of how this works, check out the following thread in the SkUnity Discord:
https://discord.com/channels/135877399391764480/1072217309852213298/1157464113476292809
The original video at this link is no longer consistent with how the gesture system works now, but there is another video in the thread posted more recently which shows some of the changes.