You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,9 @@ This gitbook contains a crash course in Skript programming, so if you're here to
6
6
7
7
For those of you who are already familiar with Skript, go ahead and use the navigation table on the left to jump to what you're interested in. Currently, only a few pages are actually complete, so you can use the links below to jump to completed tutorials. If you're interested in helping out, the github repo is linked on the right. Pull requests are welcome!
8
8
9
+
{% hint style="warning" %}
9
10
**Note:** These tutorials are for the current version of the SkriptLang Skript fork (2.6.4) and are not guaranteed to be correct for other versions or forks. This site does not include any tutorials for addons, either.
Copy file name to clipboardExpand all lines: core-concepts/commands.md
+4-1Lines changed: 4 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -178,8 +178,11 @@ command /vote:
178
178
179
179
There are also a number of expressions you can use to interact with the cooldowns of commands. You can get the remaining time with `remaining time`, the elapsed time with `elapsed time`, and the total time with `cooldown time`. You can also get the bypass permission with `bypass permission`.
180
180
181
-
If you've enabled `keep command last usage dates` in your `config.sk` file, you can get the last time the player used the command with `last usage date`.\
181
+
If you've enabled `keep command last usage dates` in your `config.sk` file, you can get the last time the player used the command with `last usage date`.
182
+
183
+
{% hint style="info" %}
182
184
You can see the full syntax for these expressions [here](https://docs.skriptlang.org/expressions.html#ExprCmdCooldownInfo).
185
+
{% endhint %}
183
186
184
187
```applescript
185
188
# The same vote command but with an improved cooldown message.
Copy file name to clipboardExpand all lines: core-concepts/indentation/conditionals.md
+9-5Lines changed: 9 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ Conditions can take a few different forms in Skript, each of which will be outli
6
6
7
7
## Dedicated Conditions
8
8
9
-
Conditions in Skript are pretty straight forward: most things you may want to check have their own dedicated condition. Some others might not have a dedicated condition, and instead use a kind of "generic" condition with an expression. For example, let's say that you wanted to check if a player is allowed to fly. You have two options:
9
+
Conditions in Skript are pretty straight forward: most things you may want to check have their own dedicated condition. Some others might not have a dedicated condition, and instead use a kind of "generic" condition with an expression. For example, let's say that you wanted to check if a player is allowed to fly. You have two options:
10
10
11
11
```applescript
12
12
if player can fly
@@ -28,7 +28,9 @@ Generic conditions are used when a dedicated condition does not exist or you hav
28
28
if player's balance < 20
29
29
```
30
30
31
-
You can see all of the various generic condition syntaxes [here, under the Comparison condition](https://docs.skriptlang.org/conditions.html#CondCompare).: 
31
+
{% hint style="info" %}
32
+
You can see all of the various generic condition syntaxes [here, under the Comparison condition](https://docs.skriptlang.org/conditions.html#CondCompare).
33
+
{% endhint %}
32
34
33
35
## If Statements
34
36
@@ -125,9 +127,9 @@ player is op
125
127
send "hello operator"
126
128
```
127
129
128
-
Note that inline ifs will skip all of the following code in their section. When they're placed at the root level of an event or command, they will effectively stop all execution if they don't pass. If placed at the root level of a loop, they'll skip to the next value like `continue` does if they don't pass. 
130
+
Note that inline ifs will skip all of the following code in their section. When they're placed at the root level of an event or command, they will effectively stop all execution if they don't pass. If placed at the root level of a loop, they'll skip to the next value like `continue` does if they don't pass.
129
131
130
-
 Inline ifs also allows you to chain conditions without indenting, like the following:
132
+
Inline ifs also allows you to chain conditions without indenting, like the following:
131
133
132
134
```applescript
133
135
player is op
@@ -150,7 +152,9 @@ send "hello" if distance between player and {spawn} <= 10
150
152
151
153
Notice how there is no indentation differences, colons, and how the effect comes first and then the condition.
152
154
155
+
{% hint style="warning" %}
153
156
Keep note that there is no `else if` or `else` options with this method.
157
+
{% endhint %}
154
158
155
159
## Ternary Operators
156
160
@@ -166,7 +170,7 @@ If it seems a bit hard to understand, let's highlight the expression itself:
166
170
"hello player" if player is not op, else "hello admin"
167
171
```
168
172
169
-
This is saying the following: 
173
+
This is saying the following:
170
174
171
175
Return the text `hello player` if the player is op.\
172
176
If they are not op (the condition fails), then return `hello admin`.
Copy file name to clipboardExpand all lines: core-concepts/variables/memory-variables-metadata-and-alternatives.md
+7-1Lines changed: 7 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,11 @@ While our standard global and local variables are versatile tools and are perfec
6
6
7
7
Memory variables are very easy to wrap your head around. Simply, they're just global variables with one difference. They don't get saved when the server stops. This means, of course, you don't get to save data over long-term, but you still get the benefits of the global scope. Plus, since they're not saved, they're also a lot gentler on the server.
8
8
9
-
These are extremely useful for when you need to transfer information between triggers or over time, but you don't really need to keep it around for the long term. Whenever you're using global variables, ask yourself if you really need to save this information over restarts. If you don't, try using a memory variable.
9
+
These are extremely useful for when you need to transfer information between triggers or over time, but you don't really need to keep it around for the long term.
10
+
11
+
{% hint style="info" %}
12
+
 Whenever you're using global variables, ask yourself if you really need to save this information over restarts. If you don't, try using a memory variable.
13
+
{% endhint %}
10
14
11
15
Now, I haven't explained how to actually write a memory variable yet, and this is because it's not a default part of Skript. You have to specifically enable them in your `config.sk` file, and they can take whatever form you give them. The general convention is to make all variables that start with `-` memory variables, eg: `{-variable}, {-list::*}`. You can do this by opening your `config.sk` file and scrolling down to line 310 or so, where you should see the following:
12
16
@@ -50,7 +54,9 @@ However, know that you can set this pattern to whatever you want, which also mea
50
54
51
55
Metadata serves a similar role to memory variables, in that it's global and it doesn't stick around over restarts. It has one major difference, though, and it's that metadata is tied to a specific "metadata holder". These holders can be a few different things, but importantly players, entities, and blocks are all metadata holders.
52
56
57
+
{% hint style="info" %}
53
58
This makes metadata ideal for temporary information tied to some entity or block, as you don't have to worry about giving it a unique name for each player or holder. You can see the syntax [here](https://docs.skriptlang.org/expressions.html#ExprMetadata).
59
+
{% endhint %}
54
60
55
61
For example, let's use metadata to make an arrow explode when it hits something:
Copy file name to clipboardExpand all lines: core-concepts/variables/options-and-the-variables-section.md
+18-5Lines changed: 18 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ The Options section and the Variables section are two powerful tools for making
4
4
5
5
## Options
6
6
7
-
Options, for those of you who have programmed in C, are like macros. For those of you who haven't, they're keywords that represent bits of code. In the options section, you say 
7
+
Options, for those of you who have programmed in C, are like macros. For those of you who haven't, they're keywords that represent bits of code. In the options section, you say
8
8
9
9
```applescript
10
10
options:
@@ -23,9 +23,10 @@ This is double-edged sword. Notice that even though we put the `{@error-msg}` di
<strong>send ""You've encountered an error!""</strong></code></pre>
26
+
<strong>send ""You've encountered an error!""
27
+
</strong></code></pre>
27
28
28
-
Be careful with options, then can help you cut down the amount of code you actually write, but they can also help obscure bugs and errors. It's also good to be wary of options in terms of parse times. I've seen people put items into options because they were tired of writing them out, or copy-pasting them. 
29
+
Be careful with options, then can help you cut down the amount of code you actually write, but they can also help obscure bugs and errors. It's also good to be wary of options in terms of parse times. I've seen people put items into options because they were tired of writing them out, or copy-pasting them.
29
30
30
31
```applescript
31
32
options:
@@ -48,7 +49,11 @@ on load:
48
49
set slot 10 of {_gui} to {item-1}
49
50
```
50
51
51
-
For you, it's nearly the same. But for the parser, it's wayyy better. **In general, try to use global variables before using options**. Options should be reserved for when they're truly needed, or for small roles like the prefixes of variable names.
52
+
For you, it's nearly the same. But for the parser, it's way better. 
53
+
54
+
{% hint style="warning" %}
55
+
**In general, try to use global variables before using options**. Options should be reserved for when they're truly needed, or for small roles like the prefixes of variable names.
56
+
{% endhint %}
52
57
53
58
## Variables Section
54
59
@@ -64,4 +69,12 @@ Essentially, the variables section defines default values for a variable. If {te
64
69
65
70
However, it is a little special for variables with types in their names, like `{test-var-2::%player%}`. Here, the variable section will give a default value of 10 to _every_ element of {`test-var-2::*}` that has a player index. If you have a new player join, and you want to get the value of `{test-var-2::%your new player%}`, the variables section will make sure that it's 10, rather than nothing.
66
71
67
-
This is a useful feature, but in my opinion the variables section is mostly useless. I've gotten by for four years now without ever using it, even though I've known of its existence for 3 of those years. Setting values in `on load` or `on first join` works just as well, and can help avoid misinterpretations of what variables are set to what. Remember, **the variable section only sets the variable if it isn't already set**. 
72
+
{% hint style="warning" %}
73
+
Beware that the default values only work if you put in an expression of the same type. `{test-var-2::%{_my-player}%}` will not get a default value, because variables always have a type of `object`.
74
+
{% endhint %}
75
+
76
+
This is a useful feature, but in my opinion the variables section is mostly useless. I've gotten by for four years now without ever using it, even though I've known of its existence for three of those years. Setting values in `on load` or `on first join` works just as well, and can help avoid misinterpretations of what variables are set to what. 
77
+
78
+
{% hint style="info" %}
79
+
Remember, **the variable section only sets the variable if it isn't already set**.
Copy file name to clipboardExpand all lines: introduction/installation.md
+5-1Lines changed: 5 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,14 @@
1
1
# Installation
2
2
3
-
Installing Skript is no different from any other plugin. You download the latest jar file, which can be found at [https://github.com/SkriptLang/Skript/releases](https://github.com/SkriptLang/Skript/releases). You should ensure your server meets the requirements for running Skript:
3
+
Installing Skript is no different from any other plugin. You download the latest jar file, which can be found at [https://github.com/SkriptLang/Skript/releases](https://github.com/SkriptLang/Skript/releases). 
4
+
5
+
{% hint style="warning" %}
6
+
You should ensure your server meets the requirements for running Skript:
4
7
5
8
* A Spigot, Paper, or Paper fork server jar. Spigot is the absolute minimum and Skript includes some features that are only accessible when using Paper or a fork of Paper.
6
9
* Minecraft Version. Currently, 2.6.4 works for 1.9 - 1.19.3, but 2.7 will only work for 1.13+. 
7
10
* 1.8 support can be found [here](https://github.com/Matocolotoe/Skript-1.8/releases), but is not official, nor recommended, nor guaranteed to work.
11
+
{% endhint %}
8
12
9
13
After you've downloaded the jar file, put it in your `plugins` folder in your server directory. Restart the server and Skript should generate the folder `plugins/Skript`. 
0 commit comments