Getting Started

Before you can start writing scripts you should download and install Skript:
  1. Download the latest Skript.jar
  2. Put the jar into your server's ‘plugin’ directory
  3. start & stop the server once to generate the config files and some example scripts

Writing a trigger

Before you even open an editor I recommend that you already know what kind of trigger you want to write, but you can also simply start writing. In this tutorial I will explain how to write a trigger similar to the one in plant with hoe.sk which is included in the download: a trigger which plants seeds when one right-clicks soil with a hoe.
To start, open a text editor, e.g. Notepad. Now think about when you want your trigger to activate. In this example we need a right click, so we write that on the first line:
on right click:
If you can't think of an event or need inspiration you can find a list of all events here.

But we don't want to activate the trigger every time someone right-clicks, but only if a player right-clicks on farmland holding a hoe, thus we should change the event:
on right click on soil holding a hoe:
We could also leave the event as-is and add two conditions instead:
on right click:
    block is soil
    player is holding a hoe
It is up to you which version you like more, I will continue using the first one in this tutorial.

Now we should check whether the player actually has seeds he could plant:
on right click on soil holding a hoe:
    player has seeds
Please note that the next line after the event is indented. This makes the line belong to the trigger we're writing and also makes scripts much easier to read. If you do not correctly indent conditions and effects you will get errors when the script loads as they do not belong to any trigger.
After that we should be able to plant the seeds as we made sure that the player did everything correctly, right?
on right click on soil holding a hoe:
    player has seeds
    set block above the clicked block to crops
This is not exactly true as there might be a block where we want to plant the seeds:
[_] <- some block
[_] <- clicked soil block
If we simply set that block to crops we might override a block. This could be used by griefers to break into other people's houses or even destroy bedrock.
Such problems are not always obvious but can cause triggers to misbehave. You can eliminate many problems by testing the triggers on a test server before using them on your main server.
This particular problem is solved by testing whether the block above the soil is empty before setting it to crops:
on right click on soil holding a hoe:
    player has seeds
    block above the clicked block is air
    set block above the clicked block to crops
Now don't forget to remove the seeds from the player if you don't want your players to plant seeds for free:
on right click on soil holding a hoe:
    player has seeds
    block above the clicked block is air
    set block above the clicked block to crops
    remove seeds from player

The last thing remaining is to save the trigger in the plugins/Skript/scripts/ directory. You can choose any name you want, but it should not start with a hyphen, as files starting with a hyphen are not loaded, and the file extension has to be .sk. You could e.g. save this tutorial's trigger as simple plant with hoe.sk.

Now start your server (which is preferably a test server, i.e. not your main server), check whether any errors appear in the console and fix them if there are any. Then log into the server and test the script to find out whether everything works as intended. When you're done testing copy the script to your main server to let your players use it.

You can also use the command ‘/skript reload’ to make Skript reload all scripts or a specific script, which is useful if you don't want to restart the server after changing a script. All errors that occur during the reload will be sent to the player that uses the command, or logged to the console if the console used the command.