Skript Introduce - LucFr1746/Minecraft-Coding GitHub Wiki
Tutorial by: eyesniper2 & LucFr
Hello and welcome to Skript!
This is a general "How to Skript" guide that will hopefully give you everything you need to get set up and begin writing your first script! This tutorial includes parts originally written by Demon on the original DBO forums and LimeGlass. This tutorial will assume that you are familiar with making a Bukkit server, but not with programming. So let's get into it!
What is Skript?
Skript is a plugin for Bukkit/Spigot, a popular Minecraft server mod, that allows server admins to easily modify how Minecraft works without programming anything.
— Peter "Njolbrim" Güttinger
Skript was created by Peter Güttinger, also known as Njolbrim or Njol, and was first released on Feb 16, 2012. The goal of Skript is to provide a simple way for non-programmers to make their own mini-plugins (called scripts). Skript is designed as an event-driven language.
This is achieved with triggers, whereof each is a collection of conditions and effects. Each time a trigger is called all conditions are checked, and if all are met, the effects are executed.
— Peter "Njolbrim" Güttinger
This means for any of your code to be run, something in the game or your server must happen. This is called an event or a trigger. These can include things like commands, a passage of time, or the actions of a player (mining a block or jumping). After something has happened, then the series of conditions and effects are run through for things to actually happen based on that event. A condition is a yes or no question your code asks the server. This can include things like: is the player online, is the player holding a pickaxe? An effect is then something that happens, these can include giving the player an item or moving the player. These building blocks combined with other elements you will learn later can be combined to produce powerful features for your server very quickly. These features will be discussed in depth later in this tutorial.
Scripts are written in text files that end in .sk. As such you can use any text editor such as VS Code, Sublime Text, NotePad++, Atom, or many others out there. However, using Microsoft Word or Google Drive will not work.
There is also a Skript IDE called SkIDE which offers a lot of nice features such as autocomplete and code highlighting.
A very basic example of a Skript can be found below:
# event
on join:
# effect
broadcast "Welcome to Skript!"
Please note that #s are used for comments and will not do something
The script above sends the message "Welcome to Skript" to everyone on the server every time someone joins the server. You might notice that the script is very easy to understand, this is because scripts are meant to be very readable, English, and easy to understand.