Gesture System

Script Gesture System 2.3.1

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

Readded the leeway option. Was removed because a version of this script with leeway was never committed to the repository where I was working from for the previous version.
- Some changes to variable naming, and changing player to UUID of player (to avoid console warnings).
- Changed the error thrown in the custom event which told the user that the gesture wasn't registered to be a warning instead.
- Made functions local.
Changed the custom event to not call a function, as this was causing an error due to issues with skript-reflect. This is a temporary fix, and the script should work exactly like it did before.
New leeway option:
  • This controls the distance from a point (up, down, left, right) the player can be looking for it to detect a motion.
  • By default, it is set to 0.5.
Also added comments to the options section to accurately describe what each of them do.
Added permission gestures.admin for easier distinction of what the average player should be able to do.
  • Players without this permission can, by default, toggle whether gestures should be registered for them, and whether they should see particles on gesture.
  • Players with can still access all the features: adding, removing, listing gestures.
  • The tab autocomplete for /gestures reflects whether or not the player has the permission.
Added 3 new options, one of which is just the permission mentioned above. The other 2 added in this update are allow-players-to-toggle-particles and show-particles-default. Both are enabled by default.
  • Have allow-players-to-toggle-particles set to true will, as the name suggests, allow players to use command /gestures toggle particles to toggle whether they see particles or not.
  • Having it set to false will ignore what the player preference is, as well as disabling use of the command, and will fall back to the show-particles-defaultoption.
    • e.g. If allow-players-to-toggle-particles is false, and show-particles-default is true, then players will be forced to see particles on gesture.
Also changed the name of the script to include an underscore at the start, to prioritize this script loading first. Previously, scripts that make use of the on gesture custom event would throw an error on server start if they loaded before.

Was debating allowing players without the gestures.admin permission to use /gestures list to see what gestures are registered. Would love to hear feedback on this.
Thanks to @ThatOneWizard, this update features a new gesture detection system.

Previously, the locations used to detect if a user had gestured in a certain direction were not very accurate, and got progressively less functional the more up/down a user looked. Essentially, if you were looking straight up or down, you wouldn't be able to gesture in any meaningful way.

In this new version, vectors are used and rotated around to work at any orientation. Additionally, the detection of when the user's cursor passes over a point is significantly more accurate as a result of this new system.
Overhauled the event system used to add code to each gesture.

New gesture event system:
  • Previously, each time a gesture was registered/removed, a file was created/deleted which allowed for a custom event corresponding to said gesture to be used.
  • Now, there is just one custom event created, which can accept any gesture sequence. It is called using the syntax gesture [[of] %gesture sequence%]. For example, the event 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":
  • As seen in the last example above, the event values for this new event are player and gesture. This means you can refer to the player who performed the gesture (e.g. for sending messages, etc.) as well as the gesture. The following line is an example of how these could both be used:
    • set {gesture::%player%::lastUsed} to event-gesture
  • The new event-gesture expression returns a string and follows the syntax [event[-| ]]gesture, so all of the following usages would be valid:
    • if gesture is "up down":
    • if event gesture is "up down":
    • if event-gesture is "up down":

That should be everything that has changed. Apologies for the breaking changes, but this update should be more efficienct, and they shouldn't be hard to fix.
The /gesture command now allows for users to delete a registered gesture. The associated script file in the gestures directory is deleted when this command is used.
Updated the /gesture command to only accept valid gesture sequences (i.e. up, down, left, right) and to only work in valid use cases. Invalid cases will not give an error message instead of trying to register an invalid gesture.