Resource icon

Command Utilities 1.1.0

Denizen Version
REL-1759

About​

Most command scripts have validation checks - remember, don't trust players - but you might find yourself repeating these throughout different commands. These injectable tasks standardize your checks and keep your scripts concise.

Tasks​

  • cmd_args: Add a required key to the command script. Injecting this will check if enough args are provided. If not, the script is stopped and the player is shown the proper syntax.
  • cmd_syntax - This is used internally by cmd_args, but you can inject this if you want to show the command syntax.
  • cmd_err - This task takes a reason definition which is then narrated in the error color. The player can hover over their message and see their command input. Additionally, the script checks if the reason definition exists, so you can inject it even if at that point it could be successful.
  • cmd_player - This task takes a user definition which is the input name for an online player. If this input returns a match, the player is then saved back to the definition; otherwise, the script injects cmd_err.
  • cmd_offline_player - The same as cmd_player, but it can match either an online or offline player.

Example​

Code:
say_hello:
    type: command
    name: hello
    description: Say hello to another user!
    usage: /hello <&lt>player<&gt>
    required: 1
    script:
    - inject cmd_args
    - define user <context.args.first>
    - inject cmd_player
    - narrate "<player.name> says hello!" targets:<[user]>
Author
acikek
Downloads
108
Views
444
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from acikek

Share this resource

Latest updates

  1. 1.1.0

    Changed hard-coded colors to the config format.