Skip to content

Commit b4231b1

Browse files
sovdeethgitbook-bot
authored andcommitted
GitBook: [#51] No subject
1 parent 564c22b commit b4231b1

File tree

8 files changed

+71
-27
lines changed

8 files changed

+71
-27
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ This gitbook contains a crash course in Skript programming, so if you're here to
66

77
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!
88

9+
{% hint style="warning" %}
910
**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.
11+
{% endhint %}
1012

1113
### Completed Pages
1214

core-concepts/commands.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,11 @@ command /vote:
178178

179179
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`.
180180

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" %}
182184
You can see the full syntax for these expressions [here](https://docs.skriptlang.org/expressions.html#ExprCmdCooldownInfo).
185+
{% endhint %}
183186

184187
```applescript
185188
# The same vote command but with an improved cooldown message.

core-concepts/indentation/conditionals.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Conditions can take a few different forms in Skript, each of which will be outli
66

77
## Dedicated Conditions
88

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:
1010

1111
```applescript
1212
if player can fly
@@ -28,7 +28,9 @@ Generic conditions are used when a dedicated condition does not exist or you hav
2828
if player's balance < 20
2929
```
3030

31-
You can see all of the various generic condition syntaxes [here, under the Comparison condition](https://docs.skriptlang.org/conditions.html#CondCompare).:&#x20;
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 %}
3234

3335
## If Statements
3436

@@ -125,9 +127,9 @@ player is op
125127
send "hello operator"
126128
```
127129

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. &#x20;
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.
129131

130-
&#x20;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:
131133

132134
```applescript
133135
player is op
@@ -150,7 +152,9 @@ send "hello" if distance between player and {spawn} <= 10
150152

151153
Notice how there is no indentation differences, colons, and how the effect comes first and then the condition.
152154

155+
{% hint style="warning" %}
153156
Keep note that there is no `else if` or `else` options with this method.
157+
{% endhint %}
154158

155159
## Ternary Operators
156160

@@ -166,7 +170,7 @@ If it seems a bit hard to understand, let's highlight the expression itself:
166170
"hello player" if player is not op, else "hello admin"
167171
```
168172

169-
This is saying the following:&#x20;
173+
This is saying the following:
170174

171175
Return the text `hello player` if the player is op.\
172176
If they are not op (the condition fails), then return `hello admin`.

core-concepts/variables/memory-variables-metadata-and-alternatives.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ While our standard global and local variables are versatile tools and are perfec
66

77
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.
88

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+
&#x20;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 %}
1014

1115
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:
1216

@@ -50,7 +54,9 @@ However, know that you can set this pattern to whatever you want, which also mea
5054

5155
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.
5256

57+
{% hint style="info" %}
5358
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 %}
5460

5561
For example, let's use metadata to make an arrow explode when it hits something:
5662

core-concepts/variables/options-and-the-variables-section.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ The Options section and the Variables section are two powerful tools for making
44

55
## Options
66

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&#x20;
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
88

99
```applescript
1010
options:
@@ -23,9 +23,10 @@ This is double-edged sword. Notice that even though we put the `{@error-msg}` di
2323

2424
<pre class="language-bash"><code class="lang-bash">send "{@error-msg}"
2525
# could become
26-
<strong>send ""You've encountered an error!""</strong></code></pre>
26+
<strong>send ""You've encountered an error!""
27+
</strong></code></pre>
2728

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.&#x20;
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.
2930

3031
```applescript
3132
options:
@@ -48,7 +49,11 @@ on load:
4849
set slot 10 of {_gui} to {item-1}
4950
```
5051

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.&#x20;
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 %}
5257

5358
## Variables Section
5459

@@ -64,4 +69,12 @@ Essentially, the variables section defines default values for a variable. If {te
6469

6570
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.
6671

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**.&#x20;
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.&#x20;
77+
78+
{% hint style="info" %}
79+
Remember, **the variable section only sets the variable if it isn't already set**.
80+
{% endhint %}

introduction/installation.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
# Installation
22

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).&#x20;
4+
5+
{% hint style="warning" %}
6+
You should ensure your server meets the requirements for running Skript:
47

58
* 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.
69
* Minecraft Version. Currently, 2.6.4 works for 1.9 - 1.19.3, but 2.7 will only work for 1.13+.&#x20;
710
* 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 %}
812

913
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`.&#x20;
1014

introduction/useful-resources.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ Here's a list of useful resources for your skripting use.
1111
### Other Tutorials
1212

1313
* [https://skripthub.net/tutorials/?search=\&sort=score](https://skripthub.net/tutorials/?search=\&sort=score)
14-
* [https://skunity.com/tutorials/](https://skunity.com/tutorials/)
15-
* [https://forums.skunity.com/](https://forums.skunity.com/)
14+
* [https://skunity.com/tutorials/](https://skunity.com/tutorials/)&#x20;
15+
* [https://forums.skunity.com/](https://forums.skunity.com/) (Make your own judgements on a post's quality)
1616

1717
### Asking for Help
1818

0 commit comments

Comments
 (0)