[Guide] - Creating a Skript

Oct 8, 2016
[Guide] - Creating a Skript
  • Skript is a new "coding language" that allows you to customize Minecraft's mechanics in plain, English sentences.
    Lots of people are using Skript, and lots of people are confused on how to use it. This is intended to teach you how to use it.

    Creating a command that broadcasts "Hello!" into chat.
    Code (Text):
    command /hello!:
            trigger:
                broadcast "&dHello!"
    Always note that indentation matters. If you mess up on the indentation, the code will not work, and you will get a message in chat when you perform the command "/sk reload scripts" that shows where the error is. For example: "indentation error: expected 12 spaces, but got 9 spaces: line 2 MySkript.sk: 'Hello!'"

    How do I use variables?
    Code (Text):
    options:
       
            errormessage: &c&lAn error has occured!
    This will make "errormessage" become a usable variable in the code. If you want the variable to show up in chat, here is an example.
    Code (Text):
    options:
       
            errormessage: &c&lAn error has occured! #-- This is the variable -- #

    command /error: #the command that makes the message show
            trigger:
                    send "{@errormessage}" #Variable that will now show up in chat
    How do I make a GUI show up?
    Making a GUI appear on the person who executed the command's screen can be a challenge. However, it really isn't.
    This sample will make the /open [player] display the arg-1's head in the center of the GUI.
    Code (Text):
    command /open [<offline player>]:
            trigger:
                open chest with 1 rows named "Test GUI :3"
                wait 1 tick
                format slot 4 of player with arg-1's skull named "&f&l%arg-1%" to be unstealable
    Please note that GUI support requires the skQuery addon to be installed.
    Is it possible to use permissions?
    Yes, it is possible to create and require the executer to have permissions to perform a command!
    You are even able to set a no permission message. Example code for permissions:
    Code (Text):
    permission: player.use
    permission message: &cYou do not have permission!
    What if the arguments aren't set, will they still be able to open the chest?
    They will be if you do not prevent it.
    You must put "if arg-2 is not set:" and insert what should happen if it's not input correctly.
    Example:
    Code (Text):
    if arg-2 is not set:
                send "&cSomething went wrong?"
            if arg-2 is set:
                open chest with 6 rows named "test" to player
                wait 1 tick
    Here are some more links that may help on learning more about Skript: https://dev.bukkit.org/bukkit-plugins/skript/forum/tutorials/53502-official-skript-tutorials
  • Loading...
  • Loading...