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!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Skript Custom Commands For Dummies. (Part 1)

Discussion in 'Tutorials' started by Purple Pixel, Dec 16, 2020.

  1. Purple Pixel

    Purple Pixel Member

    Joined:
    Sep 23, 2020
    Messages:
    40
    Likes Received:
    3
    (In this tutorial I am using 2 spaces to indent.)

    Custom Commands:

    Custom commands can come in many different ways. From simple commands to very complicated ones. For beginners, this is usually how you would want to layout your skript command.
    Code (Text):
    1. command /example:
    2.   permission:
    3.   trigger:
    There are many things that we can add to this command however, one thing to keep in mind is that in all custom commands you are probably going to see "trigger:". This is because whatever is in the trigger section is the code that is going to be run.

    Next, let's talk about some things we can do with the actual code. I am going to give an example.
    Code (Text):
    1. command /example:
    2.   trigger:
    3.     send "Hello!" to player
    So we have a skript/script now. However, it is available to all players. Let's say we want only people with a certain permission to be able to run it. This is where "permission:" comes in. Usually for whatever permissions plugin you use, you can just simply put the permission as "server.admin" for example. I recommend using the LuckPerms plugin. However, it is up to you to decide.
    Code (Text):
    1. command /example:
    2.   permission: server.admin
    3.   trigger:
    4.     send "Hello!" to player
    If you do use luckperms you can just run the command "/lp user/group groupname/username permission set server.admin true". For permissions, you can also just say "op" if you want only server operators to have access to it.

    Another thing that I suggest for custom commands you add a "permission message:" to your script. It will tell players that they do not have access to the command instead of them just running the command and nothing happens.
    Code (Text):
    1. command /example:
    2.   permission: server.admin
    3.   permission message: You do not have permission to run that command!
    4.   trigger:
    5.     send "Hello!" to player
    Ok. So now you have the real basics down. However, you want to do more. Here are just some of the examples of what you could do.
    Code (Text):
    1. command /example:
    2.   permission: server.admin
    3.   permission message:
    4.   trigger:
    5.     give player wooden pickaxe named "Cool Pickaxe"
    Code (Text):
    1. command /example:
    2.   permission: op
    3.   permission message: Only server operators can run that command!
    4.   trigger:
    5.     execute command "/title @a title {""text"":""Hello Player!"",""color"":""gold""}"
    Code (Text):
    1. command /disco:
    2.   permission: player.disco
    3.   permission message: You cannot execute that command!
    4.   trigger:
    5.     loop 5 times:
    6.       wait 1 second
    7.       execute command "/title @a title {""text"":""\o>"",""color"":""gold""}"
    8.       wait  1 second
    9.       execute command "/title @a title {""text"":""<o/"",""color"":""gold""}"
    So now you can do some stuff with it and you got some inspiration. Well, let me introduce something else to you, arguments. Arguments play a HUGE part in skript. Most times arguments look like this.
    Code (Text):
    1. command /example [<string>] [<player>]:
    You can refer to these arguments inside your code in many ways. When you are executing a command in your code or putting an argument inside quotes, you usually want to put "%arg-1%" depending on which argument you are referring to it could also be "%arg-3%" or "%arg-2%". Example:
    Code (Text):
    1. command /pickaxe [<player>]:
    2.   permission: server.player
    3.   trigger:
    4.     execute command "/give %arg-1% wooden_pickaxe"
    However, if you want to use this outside of a command or quotes use the following example.
    Code (Text):
    1. command /pickaxe [<player>]:
    2.   permission: server.player
    3.   trigger:
    4.     give arg-1 wooden pickaxe
    In part 2 of this tutorial, I will talk more in depth about these concepts. I will also introduce loops and if statements.
    (Hopefully this helped)
     
    X2S, FrostPVP™️ and DarkKingMW like this.
  2. Runakai

    Supporter

    Joined:
    Apr 27, 2018
    Messages:
    497
    Likes Received:
    31

Share This Page

Loading...