Some Skript basics covered

Hey there. This post will help you get into skript if you are just starting. What is shown here may not be the best conventions for making scripts, as this is not very advanced.

First, lets get into what you need to know. Skript files are .sk files. When you create your file, it will be named
<something>.sk
Make sure you dont make your file named <something>.sk.txt

Next, lets go over some basic things to get you started. If you have had previous programming knowledge, be prepared to throw a lot of that knowledge out of the window. Skript's syntax at times feels a lot like Python. In Skript, Indentation is very important. If you have used Java, you would probably know that indentation doesnt matter in Java. Java is a language that I describe as being able to be written in one line. Any given Java file can usually be written in, you geussed it, one line. Java has indicators that tell it when an if statement ends, or other things like that. In Skript, you dont have these indicators, so it uses indentation to know when something ends.

Dont assume things when your asking for help. If someone gives you a piece of code, and asks you to try that, dont change it. Feel free to change it after testing the orignal.

Local Variables can seem complicated, but they really are not. If a variable name starts with an underscore '_' it is a local variable. Local variables are only temporary, and can only be accessed by the trigger it was created in. Local variables are never affected by other triggers. For example:
on join:
set {_player} to player
wait 1 minute
broadcast "its been 60 seconds since %{_player}% joined the server!"

in this example, if a player joins, and then another player joins within 59 seconds of the other player, it does not say the second player's name twice


A big thing. Use list variables for anything that uses an expression in the variable name. Here are some examples:
{my.cool.variable.name} # this is OK
{score.%player%} # this is not OK
{scores.kills::%player%} # this is OK*
{scores::kills::%player% # this is OK*
{score%player%} # this is not OK

* some users use full lists, for everything. I personally dont because I think a . looks better, but lists do have advantages, such as being looped. If you plan on needing to loop it, use a list.

Some things that may annoy previous programmers:
strings are called "text"s, not strings
many other tiny things

If you have anything you would like me to add, just ask!