- 欢迎来到Minecraft插件百科!
- 对百科编辑一脸懵逼?帮助:快速入门带您快速熟悉百科编辑!
- 因近日遭受攻击,百科现已限制编辑,有意编辑请加入插件百科企鹅群:223812289
Skript:修订间差异
第1,579行: | 第1,579行: | ||
===Effects=== | ===Effects=== | ||
====Ban==== | |||
<pre>模型: | |||
Ban | |||
ban %texts/offline players% [(by reason of|because [of]|on account of|due to) %text%] | ban %texts/offline players% [(by reason of|because [of]|on account of|due to) %text%] | ||
unban %texts/offline players% | unban %texts/offline players% | ||
第1,637行: | 第1,587行: | ||
IP(-| )ban %players% [(by reason of|because [of]|on account of|due to) %text%] | IP(-| )ban %players% [(by reason of|because [of]|on account of|due to) %text%] | ||
(IP(-| )unban|un[-]IP[-]ban) %players% | (IP(-| )unban|un[-]IP[-]ban) %players% | ||
加入的版本: | |||
1.4, 2.1.1 (ban reason) | 1.4, 2.1.1 (ban reason) | ||
Bans/unbans a player or IP. | Bans/unbans a player or IP. | ||
Starting with Skript 2.1.1 and Bukkit 1.7.2 R0.4, one can also ban players with a reason. If an invalid reason is supplied (e.g. a non-existent variable) the player will still be banned, but the default reason will be used. | Starting with Skript 2.1.1 and Bukkit 1.7.2 R0.4, one can also ban players with a reason. If an invalid reason is supplied (e.g. a non-existent variable) the player will still be banned, but the default reason will be used. | ||
示例: | |||
unban player | unban player | ||
ban "127.0.0.1" | ban "127.0.0.1" | ||
IP-ban the player because "he is an idiot" | IP-ban the player because "he is an idiot"</pre> | ||
Broadcast | ===Broadcast===== | ||
<pre>模型: | |||
broadcast %texts% [(to|in) %worlds%] | broadcast %texts% [(to|in) %worlds%] | ||
加入的版本: | |||
1.0 | 1.0 | ||
Broadcasts a message to the server. | Broadcasts a message to the server. | ||
示例: | |||
broadcast "Welcome %player% to the server!" | broadcast "Welcome %player% to the server!" | ||
broadcast "Woah! It's a message!" | broadcast "Woah! It's a message!"</pre> | ||
Cancel Event | ====Cancel Event==== | ||
<pre>模型: | |||
cancel [the] event | cancel [the] event | ||
uncancel [the] event | uncancel [the] event | ||
加入的版本: | |||
1.0 | 1.0 | ||
Cancels the event (e.g. prevent blocks from being placed, or damage being taken). | Cancels the event (e.g. prevent blocks from being placed, or damage being taken). | ||
示例: | |||
on damage: | on damage: | ||
victim is a player | victim is a player | ||
victim has the permission "skript.god" | victim has the permission "skript.god" | ||
cancel the event | cancel the event</pre> | ||
Change: Set/Add/Remove/Delete/Reset | ====Change: Set/Add/Remove/Delete/Reset==== | ||
<pre>模型: | |||
(add|give) %objects% to %~objects% | (add|give) %objects% to %~objects% | ||
increase %~objects% by %objects% | increase %~objects% by %objects% | ||
第1,677行: | 第1,627行: | ||
(delete|clear) %~objects% | (delete|clear) %~objects% | ||
reset %~objects% | reset %~objects% | ||
加入的版本: | |||
1.0 (set, add, remove, delete), 2.0 (remove all) | 1.0 (set, add, remove, delete), 2.0 (remove all) | ||
A very general effect that can change many expressions. Many expressions can only be set and/or deleted, while some can have things added to or removed from them. | A very general effect that can change many expressions. Many expressions can only be set and/or deleted, while some can have things added to or removed from them. | ||
示例: | |||
# set: | # set: | ||
Set the player's display name to "<red>%name of player%" | Set the player's display name to "<red>%name of player%" | ||
第1,701行: | 第1,651行: | ||
# reset: | # reset: | ||
reset walk speed of player | reset walk speed of player | ||
reset chunk at the targeted block | reset chunk at the targeted block</pre> | ||
Colour Armour | ====Colour Armour==== | ||
<pre>模型: | |||
(dye|colo[u]r|paint) %slots/item stack% %color% | (dye|colo[u]r|paint) %slots/item stack% %color% | ||
(dye|colo[u]r|paint) %slots/item stack% (%number%, %number%, %number%) | (dye|colo[u]r|paint) %slots/item stack% (%number%, %number%, %number%) | ||
加入的版本: | |||
2.0 | 2.0 | ||
Colours leather armour in a given colour. You can also use RGB codes if you feel limited with the 16 default colours. RGB codes are three numbers from 0 to 255 in the order (red, green, blue), where (0,0,0) is black and (255,255,255) is white. | Colours leather armour in a given colour. You can also use RGB codes if you feel limited with the 16 default colours. RGB codes are three numbers from 0 to 255 in the order (red, green, blue), where (0,0,0) is black and (255,255,255) is white. | ||
示例: | |||
dye player's helmet blue | dye player's helmet blue | ||
colour the player's tool red | colour the player's tool red</pre> | ||
Command | ====Command==== | ||
<pre>模型: | |||
[execute] [the] command %texts% [by %players/console%] | [execute] [the] command %texts% [by %players/console%] | ||
[execute] [the] %players/console% command %texts% | [execute] [the] %players/console% command %texts% | ||
(let|make) %players/console% execute [[the] command] %texts% | (let|make) %players/console% execute [[the] command] %texts% | ||
加入的版本: | |||
1.0 | 1.0 | ||
Executes a command. This can be useful to use other plugins in triggers. | Executes a command. This can be useful to use other plugins in triggers. | ||
示例: | |||
make player execute command "/suicide" | make player execute command "/suicide" | ||
execute console command "/say Hello everyone!" | execute console command "/say Hello everyone!"</pre> | ||
Damage/Heal/Repair | ====Damage/Heal/Repair==== | ||
<pre>模型: | |||
damage %slots/living entities/item stack% by %number% [heart[s]] | damage %slots/living entities/item stack% by %number% [heart[s]] | ||
heal %living entities% [by %number% [heart[s]]] | heal %living entities% [by %number% [heart[s]]] | ||
repair %slots/item stack% [by %number%] | repair %slots/item stack% [by %number%] | ||
加入的版本: | |||
1.0 | 1.0 | ||
Damage/Heal/Repair an entity, or item stack. | Damage/Heal/Repair an entity, or item stack. | ||
示例: | |||
damage player by 5 hearts | damage player by 5 hearts | ||
heal the player | heal the player | ||
repair tool of player | repair tool of player</pre> | ||
Delay | ====Delay==== | ||
<pre>模型: | |||
(wait|halt) [for] %time span% | (wait|halt) [for] %time span% | ||
加入的版本: | |||
1.4 | 1.4 | ||
Delays the script's execution by a given timespan. Please note that delays are not persistent, e.g. trying to create a tempban script with ban player → wait 7 days → unban player will not work if you restart your server anytime within these 7 days. You also have to be careful even when using small delays! | Delays the script's execution by a given timespan. Please note that delays are not persistent, e.g. trying to create a tempban script with ban player → wait 7 days → unban player will not work if you restart your server anytime within these 7 days. You also have to be careful even when using small delays! | ||
示例: | |||
wait 2 minutes | wait 2 minutes | ||
halt for 5 minecraft hours | halt for 5 minecraft hours | ||
wait a tick | wait a tick</pre> | ||
Drop | ====Drop==== | ||
<pre>模型: | |||
drop %item types/experience point% [%directions% %locations%] | drop %item types/experience point% [%directions% %locations%] | ||
加入的版本: | |||
1.0 | 1.0 | ||
Drops one or more items. | Drops one or more items. | ||
示例: | |||
on death of creeper: | on death of creeper: | ||
drop 1 TNT | drop 1 TNT</pre> | ||
Enchant/Disenchant | ====Enchant/Disenchant==== | ||
<pre>模型: | |||
enchant %~item stack% with %enchantment types% | enchant %~item stack% with %enchantment types% | ||
disenchant %~item stack% | disenchant %~item stack% | ||
加入的版本: | |||
2.0 | 2.0 | ||
Enchant or disenchant an existing item | Enchant or disenchant an existing item | ||
示例: | |||
enchant the player's tool with sharpness 5 | enchant the player's tool with sharpness 5 | ||
disenchant the player's tool | disenchant the player's tool</pre> | ||
Equip | ====Equip==== | ||
<pre>模型: | |||
equip [%living entity%] with %item types% | equip [%living entity%] with %item types% | ||
make %living entity% wear %item types% | make %living entity% wear %item types% | ||
加入的版本: | |||
1.0 | 1.0 | ||
Equips a player with some given armor. This will replace any armor that the player is wearing. | Equips a player with some given armor. This will replace any armor that the player is wearing. | ||
Starting with Skript 2.1 mobs can be equipped with armour as well, pigs can be equipped with saddles, and horses can be equipped with saddles, horse armour, and chests. | Starting with Skript 2.1 mobs can be equipped with armour as well, pigs can be equipped with saddles, and horses can be equipped with saddles, horse armour, and chests. | ||
示例: | |||
equip player with diamond helmet | equip player with diamond helmet | ||
equip player with all diamond armour | equip player with all diamond armour | ||
equip the clicked horse with diamond horse armour and a saddle | equip the clicked horse with diamond horse armour and a saddle | ||
make the last spawned pig wear a saddle | make the last spawned pig wear a saddle</pre> | ||
Exit | ====Exit==== | ||
<pre>模型: | |||
(exit|stop) [trigger] | (exit|stop) [trigger] | ||
(section|loop|conditional) | (section|loop|conditional) | ||
(section|loop|conditional)s | (section|loop|conditional)s | ||
(section|loop|conditional)s | (section|loop|conditional)s | ||
加入的版本: | |||
unknown | unknown | ||
Exits a given amount of loops and conditionals, or the entire trigger. | Exits a given amount of loops and conditionals, or the entire trigger. | ||
示例: | |||
if player has any ore: | if player has any ore: | ||
stop | stop | ||
第1,793行: | 第1,743行: | ||
loop-block is not air: | loop-block is not air: | ||
exit 2 sections | exit 2 sections | ||
set loop-block to water | set loop-block to water</pre> | ||
Explosion | ====Explosion==== | ||
<pre>模型: | |||
[(create|make)] [an] explosion (of|with) (force|strength|power) %number% [%directions% %locations%] | [(create|make)] [an] explosion (of|with) (force|strength|power) %number% [%directions% %locations%] | ||
[(create|make)] [a] safe explosion (of|with) (force|strength|power) %number% [%directions% %locations%] | [(create|make)] [a] safe explosion (of|with) (force|strength|power) %number% [%directions% %locations%] | ||
[(create|make)] [a] fake explosion [%directions% %locations%] | [(create|make)] [a] fake explosion [%directions% %locations%] | ||
[(create|make)] [an] explosion[ ]effect [%directions% %locations%] | [(create|make)] [an] explosion[ ]effect [%directions% %locations%] | ||
加入的版本: | |||
1.0 | 1.0 | ||
Creates an explosion of a given force. The Minecraft Wiki has an article on explosions which lists the explosion forces of TNT, creepers, etc. | Creates an explosion of a given force. The Minecraft Wiki has an article on explosions which lists the explosion forces of TNT, creepers, etc. | ||
Use a force of 0 to create a fake explosion that does no damage whatsoever, or use the explosion effect introduced in Skript 2.0. | Use a force of 0 to create a fake explosion that does no damage whatsoever, or use the explosion effect introduced in Skript 2.0. | ||
Starting with Bukkit 1.4.5 and Skript 2.0 you can also create "safe explosions" which will damage entities but won't destroy any blocks. | Starting with Bukkit 1.4.5 and Skript 2.0 you can also create "safe explosions" which will damage entities but won't destroy any blocks. | ||
示例: | |||
create an explosion of force 10 at the player | create an explosion of force 10 at the player | ||
create a fake explosion at the victim | create a fake explosion at the victim</pre> | ||
Ignite/Extinguish | ====Ignite/Extinguish==== | ||
<pre>模型: | |||
(ignite|set fire to) %entities% [for %time span%] | (ignite|set fire to) %entities% [for %time span%] | ||
(set|light) %entities% on fire [for %time span%] | (set|light) %entities% on fire [for %time span%] | ||
extinguish %entities% | extinguish %entities% | ||
加入的版本: | |||
1.4 | 1.4 | ||
Lights entities on fire or extinguishes them. | Lights entities on fire or extinguishes them. | ||
示例: | |||
ignite the player | ignite the player | ||
extinguish the player | extinguish the player</pre> | ||
Kick | ====Kick==== | ||
<pre>模型: | |||
kick %players% [(by reason of|because [of]|on account of|due to) %text%] | kick %players% [(by reason of|because [of]|on account of|due to) %text%] | ||
加入的版本: | |||
1.0 | 1.0 | ||
Kicks a player from the server. | Kicks a player from the server. | ||
示例: | |||
on place of TNT, lava, or obsidian: | on place of TNT, lava, or obsidian: | ||
kick the player due to "You may not place %block%!" | kick the player due to "You may not place %block%!" | ||
cancel the event | cancel the event</pre> | ||
Kill | ====Kill==== | ||
<pre>模型: | |||
kill %entities% | kill %entities% | ||
加入的版本: | |||
1.0 | 1.0 | ||
Kills one or more entities. | Kills one or more entities. | ||
Note: This effect does not set the entity's health to 0 as that would make the entity disappear without the death animation and without dropping any items, but damages the entity by 100 times its maximum health. | Note: This effect does not set the entity's health to 0 as that would make the entity disappear without the death animation and without dropping any items, but damages the entity by 100 times its maximum health. | ||
示例: | |||
kill the player | kill the player | ||
kill all creepers in the player's world | kill all creepers in the player's world | ||
kill all endermen, witches and bats | kill all endermen, witches and bats</pre> | ||
Lightning | ====Lightning==== | ||
<pre>模型: | |||
[[ ]effect] %directions% %locations% | [[ ]effect] %directions% %locations% | ||
加入的版本: | |||
1.4 | 1.4 | ||
Strikes lightning at a given location. | Strikes lightning at a given location. | ||
You can use 'lightning effect' to create a lightning strike that does not harm entities or start fires (a fake fire block may be created for any client within range though). | You can use 'lightning effect' to create a lightning strike that does not harm entities or start fires (a fake fire block may be created for any client within range though). | ||
示例: | |||
strike lightning at the player | strike lightning at the player | ||
strike lightning effect at the victim | strike lightning effect at the victim</pre> | ||
Log | ====Log==== | ||
<pre>模型: | |||
log %texts% [(to|in) [file[s]] %texts%] | log %texts% [(to|in) [file[s]] %texts%] | ||
加入的版本: | |||
2.0 | 2.0 | ||
Writes text into a .log file. Skript will write these files to /plugins/Skript/logs. | Writes text into a .log file. Skript will write these files to /plugins/Skript/logs. | ||
NB: Using 'server.log' as the log file will write to the default server log. Omitting the log file altogether will log the message as '[Skript] [<script>.sk] <message>' in the server log. | NB: Using 'server.log' as the log file will write to the default server log. Omitting the log file altogether will log the message as '[Skript] [<script>.sk] <message>' in the server log. | ||
示例: | |||
on place of TNT: | on place of TNT: | ||
log "%player% placed TNT in %world% at %location of block%" to "tnt/placement.log" | log "%player% placed TNT in %world% at %location of block%" to "tnt/placement.log"</pre> | ||
Message | ====Message==== | ||
<pre>模型: | |||
(message|send [message]) %texts% [to %players/console%] | (message|send [message]) %texts% [to %players/console%] | ||
加入的版本: | |||
1.0 | 1.0 | ||
Sends a message to the given player. | Sends a message to the given player. | ||
示例: | |||
message "A wild %player% appeared!" | message "A wild %player% appeared!" | ||
message "This message is a distraction. Mwahaha!" | message "This message is a distraction. Mwahaha!" | ||
send "Your kill streak is %{kill streak.%player%}%." to player | send "Your kill streak is %{kill streak.%player%}%." to player | ||
if the targeted entity exists: | if the targeted entity exists: | ||
message "You're currently looking at a %type of the targeted entity%!" | message "You're currently looking at a %type of the targeted entity%!"</pre> | ||
op/deop | ====op/deop==== | ||
<pre>模型: | |||
[de[-]]op %offline players% | [de[-]]op %offline players% | ||
加入的版本: | |||
1.0 | 1.0 | ||
Grant/revoke a user operator status. | Grant/revoke a user operator status. | ||
示例: | |||
op the player | op the player | ||
deop all players | deop all players</pre> | ||
Open Inventory | ====Open Inventory==== | ||
<pre>模型: | |||
[(open|show) ((crafting [table]|workbench) (view|window|inventory)]|%inventory%) (to|for) %players% | [(open|show) ((crafting [table]|workbench) (view|window|inventory)]|%inventory%) (to|for) %players% | ||
close [the] inventory [view] (to|of|for) %players% | close [the] inventory [view] (to|of|for) %players% | ||
close %players%'[s] inventory [view] | close %players%'[s] inventory [view] | ||
加入的版本: | |||
2.0, 2.1.1 (closing) | 2.0, 2.1.1 (closing) | ||
Opens or closes an inventory to a player. If opened, the player can then access and modify the inventory as if it was a chest that he just opened. Closing will close any inventory the player has currently open. | Opens or closes an inventory to a player. If opened, the player can then access and modify the inventory as if it was a chest that he just opened. Closing will close any inventory the player has currently open. | ||
Please note that currently 'show' and 'open' have the same effect, but 'show' will eventually show an unmodifiable view of the inventory in the future. | Please note that currently 'show' and 'open' have the same effect, but 'show' will eventually show an unmodifiable view of the inventory in the future. | ||
示例: | |||
show the victim's inventory to the player | show the victim's inventory to the player | ||
open the player's inventory for the player | open the player's inventory for the player | ||
close the player's inventory | close the player's inventory</pre> | ||
Play Effect | ====Play Effect==== | ||
<pre>模型: | |||
(play|show) %visual effects% (on|%directions%) %entities/locations% [to %players%] | (play|show) %visual effects% (on|%directions%) %entities/locations% [to %players%] | ||
加入的版本: | |||
2.1 | 2.1 | ||
Plays a visual effect at a given location or on a given entity. | Plays a visual effect at a given location or on a given entity. | ||
Please note that some effects can only be played on entities, e..g wolf hearts or the hurt effect, and that these are always visible to all players. | Please note that some effects can only be played on entities, e..g wolf hearts or the hurt effect, and that these are always visible to all players. | ||
示例: | |||
play wolf hearts on the clicked wolf | play wolf hearts on the clicked wolf | ||
show mob spawner flames at the targeted block to the player | show mob spawner flames at the targeted block to the player</pre> | ||
Poison/Cure | ====Poison/Cure==== | ||
<pre>模型: | |||
poison %living entities% [for %time span%] | poison %living entities% [for %time span%] | ||
(cure|unpoison) %living entities% [(from|of) poison] | (cure|unpoison) %living entities% [(from|of) poison] | ||
加入的版本: | |||
1.3.2 | 1.3.2 | ||
Poison or cure a creature. | Poison or cure a creature. | ||
示例: | |||
poison the player | poison the player | ||
poison the victim for 20 seconds | poison the victim for 20 seconds | ||
cure the player from poison | cure the player from poison</pre> | ||
Potion Effects | ====Potion Effects==== | ||
<pre>模型: | |||
apply [potion of] %potions% [potion] [[[of] tier] %number%] to %living entities% [for %time span%] | apply [potion of] %potions% [potion] [[[of] tier] %number%] to %living entities% [for %time span%] | ||
加入的版本: | |||
2.0 | 2.0 | ||
Apply or remove potion effects to/from entities. | Apply or remove potion effects to/from entities. | ||
示例: | |||
apply swiftness 2 to the player | apply swiftness 2 to the player | ||
remove haste from the victim | remove haste from the victim | ||
on join: | on join: | ||
apply potion of strength of tier {strength.%player%} to the player for 999 days | apply potion of strength of tier {strength.%player%} to the player for 999 days</pre> | ||
Push | ====Push==== | ||
<pre>模型: | |||
(push|thrust) %entities% %direction% [(at|with) (speed|velocity|force) %number%] | (push|thrust) %entities% %direction% [(at|with) (speed|velocity|force) %number%] | ||
加入的版本: | |||
1.4.6 | 1.4.6 | ||
Push entities around. | Push entities around. | ||
示例: | |||
push the player upwards | push the player upwards | ||
push the victim downwards at speed 0.5 | push the victim downwards at speed 0.5</pre> | ||
PvP | ====PvP==== | ||
<pre>模型: | |||
enable PvP [in %worlds%] | enable PvP [in %worlds%] | ||
disable PVP [in %worlds%] | disable PVP [in %worlds%] | ||
加入的版本: | |||
1.3.4 | 1.3.4 | ||
Set the PvP status for a given world. | Set the PvP status for a given world. | ||
示例: | |||
enable PvP #(current world only) | enable PvP #(current world only) | ||
disable PvP in all worlds | disable PvP in all worlds</pre> | ||
Replace | ====Replace==== | ||
<pre>模型: | |||
replace [(all|every)] %texts% in %text% with %text% | replace [(all|every)] %texts% in %text% with %text% | ||
replace [(all|every)] %texts% with %text% in %text% | replace [(all|every)] %texts% with %text% in %text% | ||
加入的版本: | |||
2.0 | 2.0 | ||
Replaces all occurrences of a given text with another text. Please note that you can only change variables and a few expressions, e.g. a message or a line of a sign. | Replaces all occurrences of a given text with another text. Please note that you can only change variables and a few expressions, e.g. a message or a line of a sign. | ||
示例: | |||
replace "<item>" in {textvar} with "%tool of player%" | replace "<item>" in {textvar} with "%tool of player%" | ||
replace every "&" with "§" in line 1 | replace every "&" with "§" in line 1 | ||
# The following acts as a simple chat censor, but it will e.g. censor mass, hassle, assassin, etc. as well: | # The following acts as a simple chat censor, but it will e.g. censor mass, hassle, assassin, etc. as well: | ||
on chat: | on chat: | ||
replace all "fuck", "bitch" and "ass" with "****" in the message | replace all "fuck", "bitch" and "ass" with "****" in the message</pre> | ||
Shear | ====Shear==== | ||
<pre>模型: | |||
shear %living entities% | shear %living entities% | ||
un[-]shear %living entities% | un[-]shear %living entities% | ||
加入的版本: | |||
2.0 | 2.0 | ||
Shears or 'un-shears' a sheep. Please note that no wool is dropped, this only sets the 'sheared' state of the sheep. | Shears or 'un-shears' a sheep. Please note that no wool is dropped, this only sets the 'sheared' state of the sheep. | ||
示例: | |||
on rightclick on a sheep holding a sword: | on rightclick on a sheep holding a sword: | ||
shear the clicked sheep | shear the clicked sheep</pre> | ||
Shoot | ====Shoot==== | ||
<pre>模型: | |||
shoot %entity types% [from %living entities/locations%] [(at|with) (speed|velocity) %number%] [%direction%] | shoot %entity types% [from %living entities/locations%] [(at|with) (speed|velocity) %number%] [%direction%] | ||
(make|let) %living entities/locations% shoot %entity types% [(at|with) (speed|velocity) %number%] [%direction%] | (make|let) %living entities/locations% shoot %entity types% [(at|with) (speed|velocity) %number%] [%direction%] | ||
加入的版本: | |||
1.4 | 1.4 | ||
Shoots a projectile (or any other entity) from a given entity. | Shoots a projectile (or any other entity) from a given entity. | ||
示例: | |||
shoot an arrow | shoot an arrow | ||
make the player shoot a creeper at speed 10 | make the player shoot a creeper at speed 10 | ||
shoot a pig from the creeper | shoot a pig from the creeper</pre> | ||
Spawn | ====Spawn==== | ||
<pre>模型: | |||
spawn %entity types% [%directions% %locations%] | spawn %entity types% [%directions% %locations%] | ||
spawn %number% of %entity types% [%directions% %locations%] | spawn %number% of %entity types% [%directions% %locations%] | ||
加入的版本: | |||
1.0 | 1.0 | ||
Spawns an entity. | Spawns an entity. | ||
示例: | |||
spawn 3 creepers at the targeted block | spawn 3 creepers at the targeted block | ||
spawn a ghast 5 meters above the player | spawn a ghast 5 meters above the player</pre> | ||
Teleport | ====Teleport==== | ||
<pre>模型: | |||
teleport %entities% (to|%direction%) %location% | teleport %entities% (to|%direction%) %location% | ||
加入的版本: | |||
1.0 | 1.0 | ||
Teleports an entity to a specific location. | Teleports an entity to a specific location. | ||
If the location has a yaw or pitch set, the entity will be made facing that direction after the teleport, otherwise the entity will face the same direction as before. | If the location has a yaw or pitch set, the entity will be made facing that direction after the teleport, otherwise the entity will face the same direction as before. | ||
示例: | |||
teleport the player to {homes.%player%} | teleport the player to {homes.%player%} | ||
teleport the attacker to the victim | teleport the attacker to the victim</pre> | ||
Toggle | ====Toggle==== | ||
<pre>模型: | |||
(close|turn off|de[-]activate) %blocks% | (close|turn off|de[-]activate) %blocks% | ||
(toggle|switch) [[the] state of] %blocks% | (toggle|switch) [[the] state of] %blocks% | ||
(open|turn on|activate) %blocks% | (open|turn on|activate) %blocks% | ||
加入的版本: | |||
1.4 | 1.4 | ||
Toggles the state of a block, e.g. switches a lever or opens a door. | Toggles the state of a block, e.g. switches a lever or opens a door. | ||
示例: | |||
# use arrows to toggle levers, doors, etc. | # use arrows to toggle levers, doors, etc. | ||
on projectile hit: | on projectile hit: | ||
projectile is arrow | projectile is arrow | ||
toggle the block at the arrow | toggle the block at the arrow</pre> | ||
Tree | ====Tree==== | ||
<pre>模型: | |||
(grow|create|generate) tree [of type %tree type%] %directions% %locations% | (grow|create|generate) tree [of type %tree type%] %directions% %locations% | ||
(grow|create|generate) %tree type% [tree] %directions% %locations% | (grow|create|generate) %tree type% [tree] %directions% %locations% | ||
加入的版本: | |||
1.0 | 1.0 | ||
Creates a tree. | Creates a tree. | ||
This may require that there is enough space above the given location and that the block below is dirt/grass, but it is possible that the tree will just grow anyway, possibly replacing every block in its path. | This may require that there is enough space above the given location and that the block below is dirt/grass, but it is possible that the tree will just grow anyway, possibly replacing every block in its path. | ||
示例: | |||
grow a tall redwood tree above the clicked block | grow a tall redwood tree above the clicked block</pre> | ||
Vehicle | ====Vehicle==== | ||
<pre>模型: | |||
(make|let|force) %entities% [to] (ride|mount) [(in|on)] %entity/entity types% | (make|let|force) %entities% [to] (ride|mount) [(in|on)] %entity/entity types% | ||
[(make|let|force) %entities% [to] (dismount|(dismount|leave) (from|of)] [(any|the[ir]|his|her)] vehicle[s]) | [(make|let|force) %entities% [to] (dismount|(dismount|leave) (from|of)] [(any|the[ir]|his|her)] vehicle[s]) | ||
[(eject|dismount) (any|the)] passenger[s] (of|from) %entities% | [(eject|dismount) (any|the)] passenger[s] (of|from) %entities% | ||
加入的版本: | |||
2.0 | 2.0 | ||
Makes an entity ride another entity, e.g. a minecart, a saddled pig, an arrow, etc. | Makes an entity ride another entity, e.g. a minecart, a saddled pig, an arrow, etc. | ||
示例: | |||
make the player ride a saddled pig | make the player ride a saddled pig | ||
make the attacker ride the victim | make the attacker ride the victim | ||
</pre> | |||
===Expressions=== | ===Expressions=== | ||
Njol.ch | Njol.ch |
2016年8月16日 (二) 04:15的版本
原文地址
http://njol.ch/projects/skript/
介绍
Skript是一个流行的服务器插件。
它允许服务器管理员在不写任何Java语言的情况下简单的管理Minecraft。
这是用触发器、条件和效果三个部分做到的。
当触发器触发,所有条件均满足,效果就会被触发。
Skript的基础想法是——自定义 —— 每个服务器都能在没有自定义插件的情况下表现不同。
这比你自己钻研插件和找人写插件快的多。
同时你也不需要那么多小插件了,这一个插件就够了。
你可以在[这里]<ref>原文给的是DropBox地址无法访问,这里是作者的GitHub地址</ref>下载最新版本的Skript
已经提及了,Skript的触发器提供了这个插件的基本功能。
触发器很普通,并由一些条件和效果组成,就像这个简单的掉落修复脚本:
on break of glass: drop glass 译者注: 当打破玻璃的时候: 掉落玻璃
Skript也能用来做自定义命令。
这些基本的触发器已被改成了执行特定的命令。
下面的简单触发器允许玩家在手持物品输入/id时显示它的ID。
command /id: description: Find the ID of the item you're holding trigger: message "You're holding a %type of tool% whose ID is %id of tool%." 译者注: 当使用/id时: 描述: 获取你当前持有物的ID 触发器: 给玩家发送消息 "你现在正在拿着一个%type of tool%[工具类型] ,它的ID是 %id of tool%[工具ID]"
Skript同时也有直接从聊天栏执行效果的选项,输出一个可配置的符号打头(!是默认的)的聊天信息。
这经常被指令使用。例如,
!repair tool
,将会修复你的工具。因为这些指令非常强大且用的地方很多。 只有在玩家拥有
skript.effectcommands
权限是才能使用(OP默认不拥有!)
Skript的语法不仅限制于上面的简单指令,还包括一些循环,包含等语法。
下面的脚本是一个很简单的从附近箱子抽调燃料的例子——
on burn of fuel: fuel slot of the block is empty loop blocks in radius 1: loop-block is chest loop items of type fuel: loop-block contains loop-item remove loop-item from loop-block set fuel of the event-block to loop-item stop trigger 译者注: 当燃料燃烧时: 熔炉的燃料槽空了 在周围半径一格寻找方块: 寻找箱子 寻找物品是燃料类型 箱子包含燃料 从箱子中移除燃料 把燃料移到燃料槽 停止触发器
更多信息请前往[BukkitDev]<ref>译者注:作者的BukkitDev已经停止更新,请前往GitHub,在文章开始处</ref>,然后也请阅读下面的教程和帮助文档。
教程是新手的必读品。它解释了如何写一个脚本。这里是[另一段教程]<ref>译者注: 两段都翻译了</ref>
帮助文档是所有触发器的集合,这里面有所有关于脚本的东西。
[链接到作者论坛]
教程
作者在自带页面给出的教程
开始
在你开始写脚本之前你应该先安装Skript插件
下载最新的Skript插件,把它放入plugins,重启服务器来生成配置和一些示例脚本。
写触发器
在你打开你的编辑器之前我推荐你知道你要写什么脚本,但你可以简单地开始写了。
在这个教程中我会说明如何写一个用锄头来直接撒播种子的脚本。
它应该包括 当一个人手持锄头右键泥土时自动种植作物。
首先,打开你的文档编辑器[例如NotePad++] <ref>译者注:经测试,不推荐使用微软自带的记事本!</ref>
现在思考怎么样能让你的触发器被触发,所以我们写下第一行:
on right click: 译者注: 在右键时:
如果你不知道有哪些条件可以触发的话,点击[这里]<ref>译者注:这里是下面帮助文档的Events 事件大类</ref>
但是我们不想让人们右键都触发,只是在泥土上用锄头而已。
所以我们应该改变一下——
on right click on soil holding a hoe: 译者注: 当持有锄头右键泥土时:
我们也可以用这个事件+条件来替代——
on right click: block is soil player is holding a hoe 译者注: 当右键时: 方块是泥土 玩家手持锄头
这两种都可以,但我在这篇文档中将使用第一种。
然后我们来检测玩家有无种子:
on right click on soil holding a hoe: player has seeds 译者注: 当用锄头右键泥土时: 玩家拥有种子
请注意第二行的缩进。这会使读取器认为这是一个触发器中的语句,并且使脚本更简单的阅读。
如果你不注意这个缩进的话你的插件就会报错因为插件认为他们不属于一个触发器。
在那之后我们应该种植作物了——
on right click on soil holding a hoe: player has seeds set block above the clicked block to crops 译者注: 当手持锄头右键泥土时: 玩家拥有种子 将泥土上方的方块设置为作物
这不是很精确因为可能我们点击的泥土方块上方有方块(如下图)
[_] <- 其他方块
[_] <- 泥土方块
如果我们只是设置的话我们会覆盖掉原有方块。
这可能是别的玩家领地中的物品甚至是基岩。
这样的问题看起来并不明显但会有BUG的存在。你可以在你服务器上使用之前先在一个测试服务器上尝试运行。
这个问题可以用检测泥土上方的方块来解决——
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 当手持锄头右击方块时: 玩家拥有种子 被点击方块的上面是空气 把点击方块上面的方块设置为作物
然后不要忘了移除玩家的种子,不然他们就有免费作物了:D
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 当手持锄头右击方块时: 玩家拥有种子 被点击方块的上面是空气 把点击方块上面的方块设置为作物 移除玩家的种子
最后一件事是把你的脚本储存到
./plugins/Skript/scripts
里,你可以取任何名字。 但请不要以
-
号打头,因为这会使脚本无法读取。 文件的扩展名必须是
.sk
,例如,你可以把这个脚本储存为
hoe.sk
现在开启你的服务器[可能是测试的],检查后台有无错误信息,如果有,尝试修复。
然后登入服务器测试脚本查看是不是都可以运行。
如果你测试完毕,你可以上传到你的主服务器让玩家使用了。
你也可以使用
/sk reload 脚本名称
来使脚本重载。这方便你调试脚本,不要重启服务器。
所有的错误将会发送给使用指令的玩家。
如果后台使用,将发送给后台。
BukkitDev给出的教程
Skript的目标就是让不会语法的程序员们写他们自己的小插件[称之为脚本]。
我感觉这个目的渐渐的被人淡化因为人们也不会写脚本。
这个教程教写脚本的新人,如何让这个绝妙的插件在TA的服务器上工作。
[帮助文档]解释了你服务器所需要的所有的脚本构成。
我不是这里单一的教程帖子了,我将会引用一些他们的东西。
这个插件在你自己编程的时候非常有用,你可以做你想做的东西,以及它不需要完美的语法。
帮助文档可以在这篇文章的最上方找到。
变量,循环,指令,条件和事件—— 你写脚本的时候,你最少要用到一个,甚至你可能都需要。 下面我会详细介绍每个是干什么的,什么时候用他们——
事件
事件就是当一件事情发生的时候,例如玩家点击了一些东西,打出伤害,狗带,或一个怪物做了一些事情,甚至是环境自己改变。
这允许你做一些另外的事情——例如:
on explode: cancel event 当爆炸时: 取消事件的发生
注意空格,事件后都有一个冒号。你可以用4个或8个空格<ref>译者从来没有试过8个,都是4个</ref>。
你不能使用tab或空格来换行。我偏向于使用tab来缩进因为我只需要点一次<ref>译者喜欢4个空格 因为这样语法感觉更好</ref>
真正的事件其实非常简单。当一个爆炸发生,取消它。
这能很好地防止TNT 苦力怕的爆炸,甚至防止末影龙。
记住这个会真正的取消爆炸,就是玩家也不会受到伤害。
所以这个脚本非常简单,你可以简单的变换结局。
例如杀死服务器上的所有玩家<Ref>这个人怎么想的=-=</ref>
条件
条件是任何脚本的基础。他们是执行下一部分的条件代码。一个权限示例如下——
on rightclick: player has permission "skript.boom" create explosion with force 3 at targeted block 当右键时: 玩家拥有"skript.boom"权限 在指向方块处创造力量为3的爆炸
这会创建一个比TNT更小的爆炸,但只会在玩家拥有对应权限时工作。
条件能被用来检查玩家是否拥有物品,或牌子上写的东西。
你甚至可以用多个条件来限制效果。
on rightclick: block is a sign line 1 of sign is "[Shop]" player has permission "skript.shop" player has 2 gold nuggets remove 2 gold nuggets from player give player 1 bread message "<light green>You bought a bread."
在这个脚本中玩家必须右击一个第一行为[Shop]的牌子,拥有权限,2个金粒,然后才能有效果。
指令
每个服务器的管理员都知道指令,这是你运营服务器的方式。 Skript允许你自己自定义指令。这些命令与事件写法大体相似,除了事件需要被你自定义。
这个事件简单的版本是通过玩家输入指令来自定义效果。如果想获取更好的想法,看我下面的例子。
command /hi: permission: skript.hi trigger: message "hi"
这个简单的命令给发送/hi的玩家发送消息。第一行是事件。首先我们说要自定义一个命令,然后我们写什么命令。
然后我们给它一个权限和使用方法。最后,我们增加触发器,使我们想要指令做的事情。
你可以看网页提及的自定义命令的部分。
你也可以做一些可以获取信息的指令,或者指定被作用效果的玩家。看下面的指令:
command /hi <player>: permission: skript.hi trigger: send "hi" to argument
这个命令和之前一样发送同样的消息,但这次将会发送给别的玩家。
我们使用这个发送效果的原因是因为消息效果只发送消息给事件中的玩家,而不是输入指令的玩家。
有了发送效果,我们就能够给别的玩家发送信息了。
argument是指令中的玩家,所以当你使用/hi demon_penguin时,将会给 demon_penguin 发送hi。
同时你也可以查看网页来了解更多关于自定义命令的信息。
循环
循环任务可以用来完成复杂的任务。例如如果你想检测在你附近是不是有个箱子,你可能要检测你周围所有的方块来查看它是不是箱子。这可以用一个简单的循环解决——
command /chest: trigger: loop blocks in radius 3 around player: loop-block is a chest message "There is a chest at %location of loop-block%"
牌子上的变量会取代它的文本。这里有 x y z三个变量来代替 %location of loop-block%。
循环代码的一部分是任何方块的循环检查。 循环将会在玩家3格半径的范围内寻找箱子
因为我们在用一个自定义指令,我们可以增加寻找的范围和arguments来允许玩家选择距离。
command /chest <integer=3>: trigger: loop blocks in radius argument around player: loop-block is a chest message "There is a chest at %location of loop-block%"
这里我们为指令设置了默认值,如果在玩家没有选择的情况下为3.在循环表达中我们将argument代替了数字。
这意味着无论你输入什么数字,指令都会把其读取。如果没有输入数字,3将会成为默认值。
如果你想要看精确的半径的话,做一个圆球脚本,你就能看见尺寸了。
command /sphere <integer=3>: trigger: loop blocks in radius argument around player: loop-block is air set loop-block to stone set {clear.block} to location of player set {clear.radius} to argument command /clear: trigger: loop blocks in radius {clear.radius} around {clear.block}: loop-block is stone set loop-block to air
/clear指令将会轻松删掉你设置的圆球。同样因为你在圆球的中心,你要想一个让自己出去的方法。
这个指令可能会对地面造成一些伤害,所以请飞行来使用。
{}中的东西叫做变量,下节会说到。如果你想了解更多关于循环的知识请看帮助文档。
变量
变量是用来在名字下储存数据的。它像一个盒子上的标签,如果你想要知道盒子里的信息,只要找到正确的标签就可以。Skript的变量就是这样。你可以像这样储存变量:
set {variable.name.goes.here} to true
变量值可以是true/false ,一个坐标,或数字。这样的原因是我们可以晚些获得这个信息。所以也许我们可以检查玩家是否输入过指令,我们可以这样做:
command /sethome: trigger: set {home} to location of player command /home: trigger: teleport player to {home}
你的变量必须用{}括起来,因为这才能告诉Skript这是一个变量。上面是一个非常简单的家园脚本。
我们记录玩家的位置在一个叫做{home}的'盒子'里。当玩家输入/home时因为有变量所以我们知道把玩家传送去哪里。这不会把变量清除,它更偏向于只读类型。
即读取后放回原处。但在你写脚本中,你必须思考用户可能出错的方式。
例如玩家并没有设置他的家,那么在用/home后会发生什么?他们会被传送到哪里?
这你需要使用if来检测。检测是否有一些错误,如果没有,再继续执行脚本。
上面的脚本并不会给玩家发送信息,所以你需要自己创建——
command /sethome: trigger: set {home} to location of player command /home: trigger: if {home} is not set: message "<red>You need to set a home first!" stop trigger teleport player to {home}
现在当玩家尝试用/home时他们会受到错误提示并且剩下的脚本不会运行。
如果你忘记停止脚本,剩下的事件将照常继续运行。同时如果同时如果if判断的是false,那么剩下的代码便不会运行,玩家也收不到错误消息。
现在我们这个脚本主要的问题是当一个人/sethome后,另一个人使用/home可以直接到达这个位置。
然后在另一个人设置家后,便会覆盖前一个人家的记录。
修复它的方法是使用表达式。这些可以读取触发事件的人。
在这样输入指令后,会记录谁输入的指令。
所以让每个人都有不同的家,我们其实可以用玩家的名字作为变量。例如这样——
command /sethome: trigger: set {home.%player%} to location of player command /home: trigger: if {home.%player%} is not set: message "<red>You need to set a home first!" stop trigger teleport player to {home.%player%}
现在玩家的名字在变量中了,所以当检测是否存在时,对我将会检测{home.demon_penguin},对别人将会检测 {home.whateveryouruseernameis}。
在这个脚本中每个人都会有他们自己家的位置了。
注意事项
记住你学到的命令部分下所有的东西,都可以使用在任何触发器中。
这其中包括许多事件。
如果你想了解更多,看帮助文档吧<ref>下面的内容</ref>。
如果你关于我说的有任何疑问,或要寻求帮助等,请在这里发帖 [传送点]
-Demon 原作者 -c7w 翻译者
WIKI帮助文档
写Skript触发器并不比描述它的条件更难。
因为许多你想做的事情都与事件,例如防止方块,拉动拉杆有关,所有的触发器在触发时都被自定义。
这叫做触发器的事件。 Whenever this event occurs, e.g. when a player places a block, the trigger's conditions are checked one by one. If all conditions are met, the effects of the trigger are executed. The following is a simple example of a trigger with an event, one condition and one effect:
- event:
on place of sand: # condition: block below is air # effect: send "Watch the sand falling!" to player In case you didn't already figure out what this trigger does: It informs players who place sand in midair that the sand they just placed will fall down as there's no block below it.
To create a new trigger, start a text editor (e.g. Notepad), write the trigger, and then save it in the Skript/scripts/ directory as ‘name of the trigger.sk’, e.g. ‘plant with hoe.sk’. You can give it any name you want, but it should be meaningful so that you'll later still know what kind of triggers it contains.
After creating or changing a trigger you must either restart your server or use the command /skript reload for the changes to take effect. If you restarted the server you should check the server log for [Skript] errors, while errors will be directly sent to you if you use /skript reload. If you get any errors this means that Skript couldn't understand parts of your trigger, and it will usually tell you what is wrong. If you get a general error like can't understand '...' or '...' is not a(n) ... you should check your spelling.
You can find lists of all events, conditions and effects by clicking on the links on the top of the page.
If you need help you can post on Skript's help forum. As usual, please use the search function before posting and read this documentation, it might answer your questions. Taking a look at what others have accomplished with Skript can also help a lot in case my style of writing does not suit you well. Advanced Syntax Skript's syntax is not limited to simple statements, but can also be more complex like set fuel of block to player's tool To make things like ‘tool of …’ or ‘block below/north of/above …’ possible, so-called expressions are used. You can find a list of all expressions here.
As well as the basic syntax the trigger syntax is also more advanced. The following sections cover these special cases. Conditionals A nice feature are conditional statements. Such a statement is a part of a trigger which is only executed/checked if the section's main condition is met, which looks like this: the first line is the main condition followed by a colon: followed by one or more indented lines which are only executed if the main condition is met if a condition is not met within these lines the trigger will continue after the end of the section the trigger continues as normal after the indented lines You can also add an ‘else:’ just after the indented lines end and one or more indented lines afterwards which will be executed if the main condition isn't met. The following example demonstrates the usage of conditionals: on login: chance of 50%: give a cake to the player send "You got a gift for logging in =)" to the player else: send "You were not fortunate enough to get a gift this time. Try again next time!" to the player This script gives each player a 50% chance of receiving a cake upon logging in, notifying them of their gift or that they didn't receive a gift if they were not lucky. Loops Loops help to reduce repetitive tasks within triggers. There are currently a few loopable values, including items, blocks and players.
Loops are pretty straightforward. You say what to loop and then use that within the loop: loop values to loop: do something with the loop-value Please note that conditions behave differently in loops. If a condition is not met, only the current execution of the loop is terminated and the loop will continue with the next item. If you want conditions to exit the loop, use a conditional: condition: exit loop You can also stop the whole trigger with ‘exit’ or ‘exit trigger’.
As examples are always nice here's one. It defines a command /find which finds a block of a certain type near the player: command /find <material>: description: Find a block of the given material trigger: loop blocks in radius 10: loop-block is argument message "Found a %argument% block at %location of loop-block%" stop trigger send "There's no %argument% block around!" to player About ~ njol.ch created by Peter Güttinger ~ icons by Yusuke Kamiyamane ~ Last modified: Týr's Day, 1st October 2013, 08:25
事件
下面的列表内容是你可以开始一个触发器的事件。
每个触发器只能有一个事件,你不能在给出的语法外自行创造事件。
请注意每个事件前面的on都是完全可选的,不过我加上会感觉更好:D
请注意如果事件只有一种触发方式的话就没有例子。
At time
模型: at %time% [in %worlds%] 加入的版本: 1.3.4 关于Minecraft中所有/任一世界的时间 示例: at 18:00 at 7am in "world"
On Bed Enter
模型: [on] bed enter[ing] [on] [player] enter[ing] [a] bed 加入的版本: 1.0 当玩家上床时
On Bed Leave
模型: [on] bed leav(e|ing) [on] [player] leav(e|ing) [a] bed 加入的版本: 1.0 当玩家离开床
On Block Damage
模型: [on] block damage 加入的版本: 1.0 当玩家开始打方块,你可以用来探测左键
On Break / Mine
模型: [on] [block] (min(e|ing)) [[of] %item types%] 加入的版本: 1.0 (break), unknown (mine) Called when a block is broken by a player. If you use 'on mine', only events where the broken block dropped something will call the trigger. 示例: on mine on break of stone on mine of any ore
On Bucket Empty
模型: [on] bucket empty[ing] [on] [player] empty[ing] [a] bucket 加入的版本: 1.0 Called when a player empties a bucket. You can also use the place event with a check for water or lava.
On Bucket Fill
模型: [on] bucket fill[ing] [on] [player] fill[ing] [a] bucket 加入的版本: 1.0 Called when a player fills a bucket. Like the bucket empty event, you can also use the break event with a check for water or lava.
On Burn
模型: [on] [block] burn[ing] [[of] %item types%] 加入的版本: 1.0 Called when a block is destroyed by fire. 示例: on burn on burn of wood, fences, or chests
On Can Build Check
模型: [on] [block] can build check 加入的版本: 1.0 (basic), 2.0 ([un]cancellable) Called when a player rightclicks on a block while holding a block or a placeable item. You can either cancel the event to prevent the block from being built, or uncancel it to allow it. Please note that the data value of the block to be placed is not available in this event, only its ID.
On Chat
模型: [on] chat 加入的版本: 1.4.1 Called whenever a player chats.
On Chunk Generate
模型: [on] chunk (generat|populat)(e|ing) 加入的版本: 1.0 Called after a new chunk was generated.
On Chunk Load
模型: [on] chunk load[ing] 加入的版本: 1.0 Called when a chunk loads. The chunk might or might not contain mobs when it's loaded.
On Chunk Unload
模型: [on] chunk unload[ing] 加入的版本: 1.0 Called when a chunk is unloaded due to not being near any player. Cancel the event to force the server to keep the chunk loaded and thus keep simulating the chunk (e.g. physics, plant growth, minecarts, etc. will keep working and won't freeze).
On Click
模型: [on] [(right|left)[( |-)]][mouse[( |-)]]click[ing] [on %entity type/item type%] [(with|using|holding) %item type%] [on] [(right|left)[( |-)]][mouse[( |-)]]click[ing] (with|using|holding) %item type% on %entity type/item type% 加入的版本: 1.0 Called when a user clicks on a block, an entity or air with or without an item in their hand. Please note that rightclick events with an empty hand while not looking at a block are not sent to the server, so there's no way to detect them. 示例: on click on rightclick holding a fishing rod on leftclick on a stone or obsidian on rightclick on a creeper on click with a sword
On Combust
模型: [on] combust[ing] 加入的版本: 1.0 Called when an entity is set on fire, e.g. by fire or lava, a fireball, or by standing in direct sunlight (zombies, skeletons). See also: on ignition - called when a block catches fire.
On Command
模型: [on] command [%text%] 加入的版本: 2.0 Called when a player enters a command (not necessarily a Skript command). Please define a custom command if possible instead of using this event. Use this event only if you need to perform some action on multiple command, e.g. to prevent commands under certain circumstances, to log commands, or to add Skript checks to commands from other plugins that cannot be solved by changing the permissions of the player(s). 示例: on command on command "/stop" on command "pm Njol "
On Connect
模型: [on] [player] connect[ing] 加入的版本: 2.0 Called when a player connects to the server. This event is called before the player actually joins the server, so if you want to prevent players from joining you should prefer this event over on join. 示例: on connect: player doesn't have permission "VIP" number of players is larger than 20 kick the player due to "The last 5 slots are reserved for VIP players."
On Consume
模型: [on] [player] ((eat|drink)[ing]|consum(e|ing)) [[of] %item types%] 加入的版本: 2.0 Called when a player is done eating/drinking something, e.g. an apple, bread, meat, milk or a potion.
On Craft
模型: [on] [player] craft[ing] [[of] %item types%] 加入的版本: unknown Called when a player crafts an item.
On Creeper Power
模型: [on] creeper power 加入的版本: 1.0 Called when a creeper is struck by lighting and gets powered. Cancel the event to prevent the creeper from being powered. See also: on lightning strike
On Damage
模型: [on] damag(e|ing) [of %entity type%] 加入的版本: 1.0 Called when an entity receives damage, e.g. by an attack from another entity, lava, fire, drowning, fall, suffocation, etc. 示例: on damage on damage of a player
On Death
模型: [on] death [of %entity types%] 加入的版本: 1.0 Called when a living entity (including players) dies. 示例: on death on death of player on death of a wither or ender dragon: broadcast "A %entity% has been slain in %world%!"
On Dispense
模型: [on] dispens(e|ing) [[of] %item types%] 加入的版本: unknown Called when a dispenser dispenses an item.
On Drop
模型: [on] [player] drop[ing] [[of] %item types%] 加入的版本: unknown Called when a player drops an item from his inventory.
On Enderman/Sheep
模型: [on] enderman place [on] enderman pickup [on] sheep eat 加入的版本: unknown Called when an enderman places or picks up a block, or a sheep eats grass respectively.
On Experience Spawn
模型: [on] [e]xp[erience] [orb] spawn [on] spawn of [a[n]] [e]xp[erience] [orb] 加入的版本: 2.0 Called whenever experience is about to spawn. This is a helper event for easily being able to stop xp from spawning, as all you can currently do is cancel the event. Please note that it's impossible to detect xp orbs spawned by plugins (including Skript) with Bukkit, thus make sure that you have no such plugins if you don't want any xp orbs to spawn. (Many plugins that only change the experience dropped by blocks or entities will be detected without problems though) 示例: on xp spawn: world is "minigame_world" cancel event
On Explode
模型: [on] explo(d(e|ing)|sion) 加入的版本: 1.0 Called when an entity (a primed TNT or a creeper) explodes.
On Explosion Prime
模型: [on] explosion prime 加入的版本: 1.0 Called when an explosive is primed, i.e. an entity will explode shortly. Creepers can abort the explosion if the player gets too far away, while TNT will explode for sure after a short time.
On Fade
模型: [on] [block] fad(e|ing) [[of] %item types%] 加入的版本: 1.0 Called when a block 'fades away', e.g. ice or snow melts. 示例: on fade of snow or ice
On First Join
模型: [on] first (join|login) 加入的版本: 1.3.7 Called when a player joins the server for the first time.
On Fishing
模型: [on] [player] fish[ing] 加入的版本: 1.0 Called when a player fishes something. This is not of much use yet.
On Flow
pre><模型: [on] [block] flow[ing] [on] block mov(e|ing) 加入的版本: 1.0
Called when a blocks flows or teleports to another block. This not only applies to water and lava, but teleporting dragon eggs as well.
On Form
模型: [on] [block] form[ing] [[of] %item types%] 加入的版本: 1.0 Called when a block is created, but not by a player, e.g. snow forms due to snowfall, water freezes in cold biomes, or a block spreads (see spread event). 示例: on form of snow on form of a mushroom
On Fuel Burn
模型: [on] fuel burn[ing] 加入的版本: 1.0 Called when a furnace burns an item from its fuel slot.
On Gamemode Change
模型: [on] game[ ]mode change [to %gamemode%] 加入的版本: 1.0 Called when a player's gamemode changes. 示例: on gamemode change on gamemode change to adventure
On Grow
模型: [on] grow [of %tree type%] 加入的版本: 1.0 Called when a tree or giant mushroom grows to full size. 示例: on grow on grow of a tree on grow of a huge jungle tree
On Heal
模型: [on] heal[ing] 加入的版本: 1.0 Called when an entity is healed, e.g. by eating (players), being fed (pets), or by the effect of a potion of healing (overworld mobs) or harm (nether mobs). On Hunger Meter Change 模型: [on] (food|hunger) (level|met(er|re)|bar) chang(e|ing) 加入的版本: 1.4.4 Called when the hunger bar of a player changes, i.e. either increases by eating or decreases over time.
On Ignition
模型: [on] [block] ignit(e|ion) 加入的版本: 1.0 Called when a block starts burning, i.e. a fire block is placed next to it and this block is flammable. The burn event will be called when the block is about do be destroyed by the fire. See also: on combust - called when an entity is set on fire.
On Item Break
模型: [on] [player] tool break[ing] [on] [player] break[ing] [(a|the)] tool 加入的版本: 2.1.1 Called when a player breaks his tool because its damage reached the maximum value. This event cannot be cancelled.
On Item Spawn
模型: [on] item spawn[ing] [[of] %item types%] 加入的版本: unknown Called whenever an item stack is spawned in a world, e.g. as drop of a block or mob, a player throwing items out of his inventory, or a dispenser dispensing an item (not shooting it).
On Join
模型: [on] [player] (login|logging in|join[ing]) 加入的版本: 1.0 Called when a player joins the server. The player is already in a world when this event is called, so if you want to prevent players from joining you should prefer on connect over this event. 示例: on join: message "Welcome on our awesome server!" broadcast "%player% just joined the server!"
On Kick
模型: [on] [player] (kick|being kicked) 加入的版本: 1.0 Called when a player is kicked from the server. You can change the kick message or cancel the event entirely.
On Leaves Decay
模型: [on] leaves decay[ing] 加入的版本: 1.0 Called when a leaf block decays due to not being connected to a tree.
On Level Change
模型: [on] [player] level [change] 加入的版本: unknown Called when a player's level changes, e.g. by gathering experience or by enchanting something.
On Lightning Strike
模型: [on] lightning [strike] 加入的版本: 1.0 Called when lightning strikes. Use on creeper power and on pig zap to find out if one or more creepers and/or pigs were hit.
On Move On
模型: [on] (step|walk)[ing] (on|over) %*item types% 加入的版本: 2.0 Called when a player moves onto a certain type of block. Please note that using this event can cause lag if there are many players online. 示例: on walking on dirt or grass on stepping on stone
On Physics
模型: [on] [block] physics 加入的版本: 1.4.6 Called when a physics check is done on a block. By cancelling this event you can prevent some things from happening, e.g. sand falling, dirt turning into grass, torches dropping if their supporting block is destroyed, etc. Please note that using this event might cause quite some lag 加入的版本 it gets called extremely often. 示例: # prevents sand from falling on block physics: block is sand cancel event
On Pick Up
模型: [on] [player] (pick[ ]up|picking up) [[of] %item types%] 加入的版本: unknown Called when a player picks up an item. The item is still on the ground when this event is called.
On Pig Zap
模型: [on] pig[ ]zap 加入的版本: 1.0 Called when a pig is struck by lightning and transforms into a zombie pigman. Cancel the event to prevent the transformation. See also: on lightning strike
On Piston Extend
模型: [on] piston extend[ing] 加入的版本: 1.0 Called when a piston is about to extend.
On Piston Retract
模型: [on] piston retract[ing] 加入的版本: 1.0 Called when a piston is about to retract.
On Place
模型: [on] [block] (plac(e|ing)|build[ing]) [[of] %item types%] 加入的版本: 1.0 Called when a player places a block. 示例: on place on place of a furnace, workbench or chest
On Portal
模型: [on] [player] portal 加入的版本: 1.0 Called when a player uses a nether or end portal. Cancel the event to prevent the player from teleporting.
On Portal Create
模型: [on] portal create 加入的版本: 1.0 Called when a portal is created, either by a player or mob lighting an obsidian frame on fire, or by a nether portal creating its teleportation target in the nether/overworld. Please note that it's not possible to use the player in this event.
On Portal Enter
模型: [on] portal enter [on] entering [a] portal 加入的版本: 1.0 Called when a player enters a nether portal and the swirly animation starts to play.
On Pressure Plate / Trip
模型: [on] [step[ping] on] [a] [pressure] plate [on] (trip|[step[ping] on] [a] tripwire) 加入的版本: 1.0 (pressure plate), 1.4.4 (tripwire) Called when a player steps on a pressure plate or tripwire respectively.
On Projectile Hit
模型: [on] projectile hit 加入的版本: 1.0 Called when a projectile hits an entity or a block. Use the damage event with a check for a projectile to be able to use the entity that got hit in the case when the projectile hit a living entity. A damage event will even be fired if the damage is 0, e.g. when throwing snowballs at non-nether mobs.
On Quit
模型: [on] (quit[ting]|disconnect[ing]|log[ ]out|logging out) 加入的版本: 1.0 Called when a player leaves the server. Starting with Skript 2.0 this also includes kicked players.
On Redstone
模型: [on] redstone [current] [chang(e|ing)] 加入的版本: 1.0 Called when the redstone current of a block changes. This event is of not much use yet.
On Region Enter/Leave
模型: cannot be used directly 加入的版本: 2.1 Called when a player enters or leaves a region. This event requires a supported regions plugin to be installed. 示例: on region exit: message "Leaving %region%."
On Respawn
模型: [on] [player] respawn[ing] 加入的版本: 1.0 Called when a player respawns. You should prefer this event over the death event as the player is technically alive when this event is called.
On Script Load/Unload
模型: [on] [script] (load|init|enable) [on] [script] (unload|stop|disable) 加入的版本: 2.0 Called directly after the trigger is loaded, or directly before the whole script is unloaded. 示例: on load: set {running.%script%} to true on unload: set {running.%script%} to false
On Shoot
模型: [on] [projectile] shoot 加入的版本: 1.0 Called whenever a projectile is shot. Use the shooter expression to get who shot the projectile.
On Sign Change
模型: [on] sign (chang[e]|edit)[ing] [on] [player] (chang[e]|edit)[ing] [a] sign 加入的版本: 1.0 As signs are placed empty, this event is called when a player is done editing a sign. 示例: on sign change: line 2 is empty set line 1 to "<red>%line 1%"
On Skript Start/Stop
模型: [on] (server|skript) (start|load|enable) [on] (server|skript) (stop|unload|disable) 加入的版本: 2.0 Called when the server starts or stops (actually, when Skript starts or stops, so a /reload will trigger these events as well). 示例: on Skript start on server stop
On Smelt
模型: [on] [ore] smelt[ing] [on] smelt[ing] of ore 加入的版本: 1.0 Called when a furnace smelts an item in its ore slot.
On Sneak Toggle
模型: [on] [player] toggl(e|ing) sneak [on] [player] sneak toggl(e|ing) 加入的版本: 1.0 Called when a player starts or stops sneaking. Use is sneaking to get whether the player was sneaking before the event was called. 示例: # make players that stop sneaking jump on sneak toggle: player was sneaking push the player upwards at speed 0.5
On Spawn
模型: [on] spawn[ing] [of %entity types%] 加入的版本: 1.0 Called when an creature spawns. 示例: on spawn of a zombie on spawn of an ender dragon: broadcast "A dragon has been sighted in %world%!"
On Spawn Change
模型: [on] [world] spawn change 加入的版本: 1.0 Called when the spawn point of a world changes.
On Spread
模型: [on] spread[ing] 加入的版本: 1.0 Called when a new block forms as a result of a block that can spread, e.g. water or mushrooms.
On Sprint Toggle
模型: [on] [player] toggl(e|ing) sprint [on] [player] sprint toggl(e|ing) 加入的版本: unknown Called when a player starts or stops sprinting. Use is sprinting to get whether the player was sprinting before the event was called.
On Tame
模型: [on] [entity] tam(e|ing) 加入的版本: 1.0 Called when a player tames a wolf or ocelot. Can be cancelled to prevent the entity from being tamed.
On Target
模型: [on] [entity] target [on] [entity] un[-]target 加入的版本: 1.0 Called when a mob starts/stops following/attacking another entity, usually a player. Please note that even though the target expression also works for a player's target this event is not called for players.
On Teleport
模型: [on] [player] teleport[ing] 加入的版本: 1.0 Called whenever a player is teleported, either by a nether/end portal or other means (e.g. by plugins).
On Throwing of an Egg
模型: [on] throw[ing] [of] [an] egg [on] [player] egg throw 加入的版本: 1.0 Called when a player throws an egg. You can just use the shoot event in most cases, as this event is intended to support changing the hatched mob and its chance to hatch, but Skript does not yet support that.
On Tool Change
模型: [on] [player['s]] (tool|item held|held item) chang(e|ing) 加入的版本: 1.0 Called whenever a player changes his held item by selecting a different slot (e.g. the keys 1-9 or the mouse wheel), but not by dropping or replacing the item in the current slot.
On Vehicle Create
模型: [on] vehicle create [on] creat(e|ing|ion of) [a] vehicle 加入的版本: 1.0 Called when a new vehicle is created, e.g. when a player places a boat or minecart.
On Vehicle Damage
模型: [on] vehicle damage [on] damag(e|ing) [a] vehicle 加入的版本: 1.0 Called when a vehicle gets damage. Too much damage will destroy the vehicle.
On Vehicle Destroy
模型: [on] vehicle destroy [on] destr(oy[ing]|uction of) [a] vehicle 加入的版本: 1.0 Called when a vehicle is destroyed. Any passenger will be ejected and the vehicle might drop some item(s).
On Vehicle Enter
模型: [on] vehicle enter [on] enter[ing] [a] vehicle 加入的版本: 1.0 Called when an entity enters a vehicle, either deliberately (players) or by falling into them (mobs).
On Vehicle Exit
模型: [on] vehicle exit [on] exit[ing] [a] vehicle 加入的版本: 1.0 Called when an entity exits a vehicle.
On Weather Change
模型: [on] weather change [to %weather types%] 加入的版本: 1.0 Called when a world's weather changes. 示例: on weather change on weather change to sunny
On World Init
模型: [on] world init 加入的版本: 1.0 Called when a world is initialised. As all default worlds are initialised before any scripts are loaded, this event is only called for newly created worlds. World management plugins might change the behaviour of this event though.
On World Load
模型: [on] world load[ing] 加入的版本: 1.0 Called when a world is loaded. As with the world init event, this event will not be called for the server's default world(s).
On World Save
模型: [on] world sav(e|ing) 加入的版本: 1.0 Called when a world is saved to disk. Usually all worlds are saved simultaneously, but world management plugins could change this.
On World Unload
模型: [on] world unload[ing] 加入的版本: 1.0 Called when a world is unloaded. This event might never be called if you don't have a world management plugin.
On Zombie Break Door
模型: [on] zombie break[ing] [a] [wood[en]] door 加入的版本: unknown Called when a zombie is done breaking a wooden door. Can be cancelled to prevent the zombie from breaking the door.
Periodical
模型: every %time span% in [world[s]] %worlds% 加入的版本: 1.0 An event that is called periodically. The event is used like 'every <timespan>', e.g. 'every second' or 'every 5 minutes'. 示例: every second every minecraft hour every tick # warning: lag! every minecraft day in "world"
Can Build
模型: cannot be used directly 加入的版本: 2.0 Tests whether a player is allowed to build at a certain location. This condition requires that a supported regions plugin is installed. 示例: command /setblock <material>: description: set the block at your crosshair to a different type trigger: player cannot build at the targeted block: message "You do not have permission to change blocks there!" stop set the targeted block to argument
Can Hold
模型: %inventories% (can hold|ha(s|ve) [enough] space (for|to hold)) %item types% %inventories% (can(no|')t hold|(ha(s|ve) not|ha(s|ve)n't|do[es]n't have) [enough] space (for|to hold)) %item types% 加入的版本: 1.0 Tests whether a player or a chest has enough free space to hold the given item. This includes trying to fill existing stacks of the tested item(s). 示例: block can hold 200 cobblestone player has enough space for 64 feathers
Chance
模型: chance of %number%[\%] 加入的版本: 1.0 A condition that randomly succeeds or fails. Valid values are between 0% and 100%, or if the percent sign is omitted between 0 and 1. 示例: chance of 50%: drop a diamond chance of {var}% # {var} between 0 and 100 chance of {var} # {var} between 0 and 1
Comparison
模型: [neither] %objects% ((is|are) ((greater|more|higher|bigger|larger) than|above)|>) %objects% [neither](neither)|isn't|aren't) ((less|smaller) than|below)|>=) %objects% [neither] %objects% ((is|are) ((less|smaller) than|below)|<) %objects% [neither](neither)|isn't|aren't) ((greater|more|higher|bigger|larger) than|above)|<=) %objects% [neither](neither)|isn't|aren't|!=) [equal to] %objects% [neither] %objects% (is|are|=) [(equal to|the same as)] %objects% [neither] %objects% (is|are) between %objects% and %objects% [neither](is not|are not|isn't|aren't) between %objects% and %objects% 加入的版本: 1.0 A very general condition, it simply compares two values. Usually you can only compare for equality (e.g. block is/isn't of <type>), but some values can also be compared using greater than/less than. In that case you can also test for whether an object is between two others. Note: This is the only element where not all patterns are shown. It has actually another two sets of similar patters, but with (was|were) or will be instead of (is|are) respectively, which check different time states of the first expression. 示例: the clicked block is a stone slab or a double stone slab time in the player's world is greater than 8:00 the creature is not an enderman or an ender dragon
Contains
模型: %inventories% ha(s|ve) %item types% [in [(the[ir]|his|her|its)] inventory] %inventories/texts/objects% contain[s] %item types/texts/objects% %inventories% do[es](n't| not) have %item types% [in [(the[ir]|his|her|its)] inventory] %inventories/texts/objects% do[es](n't| not) contain %item types/texts/objects% 加入的版本: 1.0 Checks whether an inventory contains the given item, a text contains another piece of text, or a list of objects (e.g. a {list variable::*}) contains another object. 示例: block contains 20 cobblestone player has 4 flint and 2 iron ingots
Damage Cause
模型: [the] damage [(n('|o)]t) [been] (caused|done|made) by %damage cause% 加入的版本: 2.0 Tests what kind of damage caused a damage event. Refer to the Damage Cause type for a list of all possible causes. 示例: # make players use their potions of fire resistance whenever they take any kind of fire damage on damage: damage was caused by lava, fire or burning victim is a player victim has a potion of fire resistance cancel event apply fire resistance to the victim for 30 seconds remove 1 potion of fire resistance from the victim # prevent mobs from dropping items under certain circumstances on death; entity is not a player damage wasn't caused by a block explosion, an attack, a projectile, a potion, fire, burning, thorns or poison clear drops
Exists/Is Set
模型: %~objects% (exist[s]|(is|are) set) %~objects% (do[es](n't| not) exist|(is|are)(n't| not) set) 加入的版本: 1.2 Checks whether a given expression or variable is set. 示例: {teamscript.%player%.preferred team} is not set on damage: projectile exists broadcast "%attacker% used a %projectile% to attack %victim%!"
Has Permission
模型: [%players/console%] (do[es]n't|don't|do[es] not) have [the] permission[s] %texts% [%players/console%] ha(s|ve) [the] permission[s] %texts% 加入的版本: 1.0 Test whether a player has a certain permission. 示例: player has permission "skript.tree" victim has the permission "admin": send "You're attacking an admin!" to attacker
Has Played Before
模型: %offline player% [(has|did)] [already] play[ed] [on (this|the) server] (before|already) %offline player% (has not|hasn't|did not|didn't) [(already|yet)] play[ed] [on (this|the) server] (before|already|yet) 加入的版本: 1.4 Checks whether a player has played on this server before. You can also use on first join if you want to make triggers for new players. 示例: player has played on this server before player hasn't played before
Is Alive
模型: %living entities% (alive|dead) %living entities% (alive|dead) 加入的版本: 2.0 Checks whetehr an entity is alive. This is mostly useful to check whether an entity stored in a variable does still exist 示例: {villagerbuddy.%player%} is dead
Is Banned
模型: %offline players/texts% (is|are) banned %players/texts% [(is|are) IP(-| )]banned %offline players/texts% (isn't|is not|aren't|are not) banned %players/texts% [(isn't|is not|aren't|are not) IP(-| )]banned 加入的版本: 1.4 Checks whether a player or IP is banned. 示例: player is banned victim is not IP-banned "127.0.0.1" is banned
Is Blocking
模型: %players% (is|are) (blocking|defending) %players% (isn't|is not|aren't|are not) (blocking|defending) 加入的版本: unknown Checks whether a player is blocking with his sword. 示例: victim is blocking
Is Burning
模型: %entities% (is|are) (burning|ignited|on fire) %entities% (isn't|is not|aren't|are not) (burning|ignited|on fire) 加入的版本: 1.4.4 Checks whether an entity is on fire, e.g. a zombie due to being in sunlight, or any entity after falling into lava. 示例: # increased attack against buring targets victim is burning: increase damage by 2
Is Empty
模型: %inventories/slots/texts% (is|are) empty %inventories/slots/texts% (isn't|is not|aren't|are not) empty 加入的版本: unknown Checks whether an inventory, an inventory slot, or a text is empty. 示例: player's inventory is empty
Is Enchanted
模型: %item types% (is|are) enchanted [with %enchantment type%] %item types% (isn't|is not|aren't|are not) enchanted [with %enchantment type%] 加入的版本: 1.4.6 Checks whether an item is enchanted. 示例: tool of the player is enchanted with efficiency 2 helm, chestplate, leggings or boots are enchanted
Is Flying
模型: %players% (is|are) flying %players% (isn't|is not|aren't|are not) flying 加入的版本: 1.4.4 Checks whether a player is flying 示例: player is not flying
Is Holding
模型: [%living entities%] ha(s|ve) %item types% in hand [%living entities%] (is|are) holding %item types% [%living entities%] (ha(s|ve) not|do[es]n't have) %item types% in hand [%living entities%] (is not|isn't) holding %item types% 加入的版本: 1.0 Checks whether a player is holdign a specific item. Cannot be used with endermen, use 'entity is [not] an enderman holding <item type>' instead. 示例: player is holding a stick victim isn't holding a sword of sharpness
Is in World
模型: %entities% (is|are) in [[the] world[s]] %worlds% %entities% (is not|isn't|are not|aren't) in [[the] world[s]] %worlds% 加入的版本: 1.4 Checks whether an entity is in a specific world 示例: player is in "world" argument isn't in world "world_nether" the attacker is in the world of the victim
Is Member/Owner of Region
模型: cannot be used directly 加入的版本: 2.1 Checks whetehr a player is a member or owner of a particular region. This condition requires a supported regions plugin to be installed. 示例: on region enter: player is the owner of the region message "Welcome back to %region%!" send "%player% just entered %region%!" to all members of the region
Is of Type
模型: %item stacks/entities% (is|are) of type[s] %item types/entity types% %item stacks/entities% (isn't|is not|aren't|are not) of type[s] %item types/entity types% 加入的版本: 1.4 Checks whether an item of entity is of the given type. This is mostly useful for variables, as you can use the general 'is' condition otherwise (e.g. 'victim is a creeper'). 示例: tool is of type {*selected type} victim is of type {villager type}
Is Online
模型: %offline players% ((is|are) online|(is not|isn't|are not|aren't) offline) %offline players% ((is|are) offline|(is not|isn't|are not|aren't) online) 加入的版本: 1.4 Checks whether a player is online. 示例: player is online player-argument is offline
Is Poisoned
模型: %living entities% (is|are) poisoned %living entities% (isn't|is not|aren't|are not) poisoned 加入的版本: 1.4.4 Checks whether an entity is poisoned. 示例: player is poisoned: cure the player from posion message "You have been cured!"
Is Riding
模型: %entities% (is|are) riding [%entity types%] %entities% (isn't|is not|aren't|are not) riding [%entity types%] 加入的版本: 2.0 Tests whether an entity is riding another or is in a vehicle. 示例: player is riding a saddled pig
Is Sleeping
模型: %players% (is|are) sleeping %players% (isn't|is not|aren't|are not) sleeping 加入的版本: 1.4.4 Checks whether a player is sleeping. 示例: # cut your enemies' throats in their sleep >=) on attack: attacker is holding a sword victim is sleeping increase the damage by 1000
Is Sneaking
模型: %players% (is|are) sneaking %players% (isn't|is not|aren't|are not) sneaking 加入的版本: 1.4.4 Checks whether a player is sneaking 示例: # prevent mobs from seeing sneaking players if they are at least 4 meters apart on target: target is sneaking distance of target and the entity is bigger than 4 cancel the event
Is Sprinting
模型: %players% (is|are) sprinting %players% (isn't|is not|aren't|are not) sprinting 加入的版本: 1.4.4 Checks whether a player is sprinting 示例: player is not sprinting
Is Wearing
模型: %living entities% (is|are) wearing %item types% %living entities% (isn't|is not|aren't|are not) wearing %item types% 加入的版本: 1.0 Checks whether a player is wearing some armour. 示例: player is wearing an iron chestplate and iron leggings player is wearing all diamond armour
PvP
模型: (is PvP|PvP is) enabled [in %worlds%] (is PvP|PvP is) disabled [in %worlds%] 加入的版本: 1.3.4 Checks the PvP status of a world. 示例: PvP is enabled PvP is disabled in "world"
Region Contains
模型: cannot be used directly 加入的版本: 2.1 Checks whether a location is contained in a particular region. This condition requires a supported regions plugin to be installed. 示例: player is in the region {regions::3} on region enter: region contains {flags.%world%.red} message "The red flag is near!"
Time
模型: %date% (was|were)( more|(n't| not) less) than %time span% [ago] %date% (was|were)((n't| not) more| less) than %time span% [ago] 加入的版本: 2.0 Tests whether a given real time was more or less than some time span ago. 示例: command /command_with_cooldown: trigger: {command.%player%.lastused} was less than a minute ago: message "Please wait a minute between uses of this command." stop set {command.%player%.lastused} to now # ... actual command trigger here ...
Weather
模型: is %weather types% [in %worlds%] 加入的版本: 1.0 Checks whether the weather in a world is of a specific type. I welcome any ideas how to write this condition differently. 示例: is thundering is raining in "world" or "world2"
Effects
Ban
模型: ban %texts/offline players% [(by reason of|because [of]|on account of|due to) %text%] unban %texts/offline players% ban %players% by IP [(by reason of|because [of]|on account of|due to) %text%] unban %players% by IP IP(-| )ban %players% [(by reason of|because [of]|on account of|due to) %text%] (IP(-| )unban|un[-]IP[-]ban) %players% 加入的版本: 1.4, 2.1.1 (ban reason) Bans/unbans a player or IP. Starting with Skript 2.1.1 and Bukkit 1.7.2 R0.4, one can also ban players with a reason. If an invalid reason is supplied (e.g. a non-existent variable) the player will still be banned, but the default reason will be used. 示例: unban player ban "127.0.0.1" IP-ban the player because "he is an idiot"
Broadcast==
模型: broadcast %texts% [(to|in) %worlds%] 加入的版本: 1.0 Broadcasts a message to the server. 示例: broadcast "Welcome %player% to the server!" broadcast "Woah! It's a message!"
Cancel Event
模型: cancel [the] event uncancel [the] event 加入的版本: 1.0 Cancels the event (e.g. prevent blocks from being placed, or damage being taken). 示例: on damage: victim is a player victim has the permission "skript.god" cancel the event
Change: Set/Add/Remove/Delete/Reset
模型: (add|give) %objects% to %~objects% increase %~objects% by %objects% give %~objects% %objects% set %~objects% to %objects% remove (all|every) %objects% from %~objects% (remove|subtract) %objects% from %~objects% reduce %~objects% by %objects% (delete|clear) %~objects% reset %~objects% 加入的版本: 1.0 (set, add, remove, delete), 2.0 (remove all) A very general effect that can change many expressions. Many expressions can only be set and/or deleted, while some can have things added to or removed from them. 示例: # set: Set the player's display name to "<red>%name of player%" set the block above the victim to lava # add: add 2 to the player's health # preferably use '<a href='#heal'>heal</a>' for this add argument to {blacklist::*} give a diamond pickaxe of efficiency 5 to the player increase the data value of the clicked block by 1 # remove: remove 2 pickaxes from the victim subtract 2.5 from {points.%player%} # remove all: remove every iron tool from the player remove all minecarts from {entitylist::*} # delete: delete the block below the player clear drops delete {variable} # reset: reset walk speed of player reset chunk at the targeted block
Colour Armour
模型: (dye|colo[u]r|paint) %slots/item stack% %color% (dye|colo[u]r|paint) %slots/item stack% (%number%, %number%, %number%) 加入的版本: 2.0 Colours leather armour in a given colour. You can also use RGB codes if you feel limited with the 16 default colours. RGB codes are three numbers from 0 to 255 in the order (red, green, blue), where (0,0,0) is black and (255,255,255) is white. 示例: dye player's helmet blue colour the player's tool red
Command
模型: [execute] [the] command %texts% [by %players/console%] [execute] [the] %players/console% command %texts% (let|make) %players/console% execute [[the] command] %texts% 加入的版本: 1.0 Executes a command. This can be useful to use other plugins in triggers. 示例: make player execute command "/suicide" execute console command "/say Hello everyone!"
Damage/Heal/Repair
模型: damage %slots/living entities/item stack% by %number% [heart[s]] heal %living entities% [by %number% [heart[s]]] repair %slots/item stack% [by %number%] 加入的版本: 1.0 Damage/Heal/Repair an entity, or item stack. 示例: damage player by 5 hearts heal the player repair tool of player
Delay
模型: (wait|halt) [for] %time span% 加入的版本: 1.4 Delays the script's execution by a given timespan. Please note that delays are not persistent, e.g. trying to create a tempban script with ban player → wait 7 days → unban player will not work if you restart your server anytime within these 7 days. You also have to be careful even when using small delays! 示例: wait 2 minutes halt for 5 minecraft hours wait a tick
Drop
模型: drop %item types/experience point% [%directions% %locations%] 加入的版本: 1.0 Drops one or more items. 示例: on death of creeper: drop 1 TNT
Enchant/Disenchant
模型: enchant %~item stack% with %enchantment types% disenchant %~item stack% 加入的版本: 2.0 Enchant or disenchant an existing item 示例: enchant the player's tool with sharpness 5 disenchant the player's tool
Equip
模型: equip [%living entity%] with %item types% make %living entity% wear %item types% 加入的版本: 1.0 Equips a player with some given armor. This will replace any armor that the player is wearing. Starting with Skript 2.1 mobs can be equipped with armour as well, pigs can be equipped with saddles, and horses can be equipped with saddles, horse armour, and chests. 示例: equip player with diamond helmet equip player with all diamond armour equip the clicked horse with diamond horse armour and a saddle make the last spawned pig wear a saddle
Exit
模型: (exit|stop) [trigger] (section|loop|conditional) (section|loop|conditional)s (section|loop|conditional)s 加入的版本: unknown Exits a given amount of loops and conditionals, or the entire trigger. 示例: if player has any ore: stop message "%player% has no ores!" loop blocks above the player: loop-block is not air: exit 2 sections set loop-block to water
Explosion
模型: [(create|make)] [an] explosion (of|with) (force|strength|power) %number% [%directions% %locations%] [(create|make)] [a] safe explosion (of|with) (force|strength|power) %number% [%directions% %locations%] [(create|make)] [a] fake explosion [%directions% %locations%] [(create|make)] [an] explosion[ ]effect [%directions% %locations%] 加入的版本: 1.0 Creates an explosion of a given force. The Minecraft Wiki has an article on explosions which lists the explosion forces of TNT, creepers, etc. Use a force of 0 to create a fake explosion that does no damage whatsoever, or use the explosion effect introduced in Skript 2.0. Starting with Bukkit 1.4.5 and Skript 2.0 you can also create "safe explosions" which will damage entities but won't destroy any blocks. 示例: create an explosion of force 10 at the player create a fake explosion at the victim
Ignite/Extinguish
模型: (ignite|set fire to) %entities% [for %time span%] (set|light) %entities% on fire [for %time span%] extinguish %entities% 加入的版本: 1.4 Lights entities on fire or extinguishes them. 示例: ignite the player extinguish the player
Kick
模型: kick %players% [(by reason of|because [of]|on account of|due to) %text%] 加入的版本: 1.0 Kicks a player from the server. 示例: on place of TNT, lava, or obsidian: kick the player due to "You may not place %block%!" cancel the event
Kill
模型: kill %entities% 加入的版本: 1.0 Kills one or more entities. Note: This effect does not set the entity's health to 0 as that would make the entity disappear without the death animation and without dropping any items, but damages the entity by 100 times its maximum health. 示例: kill the player kill all creepers in the player's world kill all endermen, witches and bats
Lightning
模型: [[ ]effect] %directions% %locations% 加入的版本: 1.4 Strikes lightning at a given location. You can use 'lightning effect' to create a lightning strike that does not harm entities or start fires (a fake fire block may be created for any client within range though). 示例: strike lightning at the player strike lightning effect at the victim
Log
模型: log %texts% [(to|in) [file[s]] %texts%] 加入的版本: 2.0 Writes text into a .log file. Skript will write these files to /plugins/Skript/logs. NB: Using 'server.log' as the log file will write to the default server log. Omitting the log file altogether will log the message as '[Skript] [<script>.sk] <message>' in the server log. 示例: on place of TNT: log "%player% placed TNT in %world% at %location of block%" to "tnt/placement.log"
Message
模型: (message|send [message]) %texts% [to %players/console%] 加入的版本: 1.0 Sends a message to the given player. 示例: message "A wild %player% appeared!" message "This message is a distraction. Mwahaha!" send "Your kill streak is %{kill streak.%player%}%." to player if the targeted entity exists: message "You're currently looking at a %type of the targeted entity%!"
op/deop
模型: [de[-]]op %offline players% 加入的版本: 1.0 Grant/revoke a user operator status. 示例: op the player deop all players
Open Inventory
模型: [(open|show) ((crafting [table]|workbench) (view|window|inventory)]|%inventory%) (to|for) %players% close [the] inventory [view] (to|of|for) %players% close %players%'[s] inventory [view] 加入的版本: 2.0, 2.1.1 (closing) Opens or closes an inventory to a player. If opened, the player can then access and modify the inventory as if it was a chest that he just opened. Closing will close any inventory the player has currently open. Please note that currently 'show' and 'open' have the same effect, but 'show' will eventually show an unmodifiable view of the inventory in the future. 示例: show the victim's inventory to the player open the player's inventory for the player close the player's inventory
Play Effect
模型: (play|show) %visual effects% (on|%directions%) %entities/locations% [to %players%] 加入的版本: 2.1 Plays a visual effect at a given location or on a given entity. Please note that some effects can only be played on entities, e..g wolf hearts or the hurt effect, and that these are always visible to all players. 示例: play wolf hearts on the clicked wolf show mob spawner flames at the targeted block to the player
Poison/Cure
模型: poison %living entities% [for %time span%] (cure|unpoison) %living entities% [(from|of) poison] 加入的版本: 1.3.2 Poison or cure a creature. 示例: poison the player poison the victim for 20 seconds cure the player from poison
Potion Effects
模型: apply [potion of] %potions% [potion] [[[of] tier] %number%] to %living entities% [for %time span%] 加入的版本: 2.0 Apply or remove potion effects to/from entities. 示例: apply swiftness 2 to the player remove haste from the victim on join: apply potion of strength of tier {strength.%player%} to the player for 999 days
Push
模型: (push|thrust) %entities% %direction% [(at|with) (speed|velocity|force) %number%] 加入的版本: 1.4.6 Push entities around. 示例: push the player upwards push the victim downwards at speed 0.5
PvP
模型: enable PvP [in %worlds%] disable PVP [in %worlds%] 加入的版本: 1.3.4 Set the PvP status for a given world. 示例: enable PvP #(current world only) disable PvP in all worlds
Replace
模型: replace [(all|every)] %texts% in %text% with %text% replace [(all|every)] %texts% with %text% in %text% 加入的版本: 2.0 Replaces all occurrences of a given text with another text. Please note that you can only change variables and a few expressions, e.g. a message or a line of a sign. 示例: replace "<item>" in {textvar} with "%tool of player%" replace every "&" with "§" in line 1 # The following acts as a simple chat censor, but it will e.g. censor mass, hassle, assassin, etc. as well: on chat: replace all "fuck", "bitch" and "ass" with "****" in the message
Shear
模型: shear %living entities% un[-]shear %living entities% 加入的版本: 2.0 Shears or 'un-shears' a sheep. Please note that no wool is dropped, this only sets the 'sheared' state of the sheep. 示例: on rightclick on a sheep holding a sword: shear the clicked sheep
Shoot
模型: shoot %entity types% [from %living entities/locations%] [(at|with) (speed|velocity) %number%] [%direction%] (make|let) %living entities/locations% shoot %entity types% [(at|with) (speed|velocity) %number%] [%direction%] 加入的版本: 1.4 Shoots a projectile (or any other entity) from a given entity. 示例: shoot an arrow make the player shoot a creeper at speed 10 shoot a pig from the creeper
Spawn
模型: spawn %entity types% [%directions% %locations%] spawn %number% of %entity types% [%directions% %locations%] 加入的版本: 1.0 Spawns an entity. 示例: spawn 3 creepers at the targeted block spawn a ghast 5 meters above the player
Teleport
模型: teleport %entities% (to|%direction%) %location% 加入的版本: 1.0 Teleports an entity to a specific location. If the location has a yaw or pitch set, the entity will be made facing that direction after the teleport, otherwise the entity will face the same direction as before. 示例: teleport the player to {homes.%player%} teleport the attacker to the victim
Toggle
模型: (close|turn off|de[-]activate) %blocks% (toggle|switch) [[the] state of] %blocks% (open|turn on|activate) %blocks% 加入的版本: 1.4 Toggles the state of a block, e.g. switches a lever or opens a door. 示例: # use arrows to toggle levers, doors, etc. on projectile hit: projectile is arrow toggle the block at the arrow
Tree
模型: (grow|create|generate) tree [of type %tree type%] %directions% %locations% (grow|create|generate) %tree type% [tree] %directions% %locations% 加入的版本: 1.0 Creates a tree. This may require that there is enough space above the given location and that the block below is dirt/grass, but it is possible that the tree will just grow anyway, possibly replacing every block in its path. 示例: grow a tall redwood tree above the clicked block
Vehicle
模型: (make|let|force) %entities% [to] (ride|mount) [(in|on)] %entity/entity types% [(make|let|force) %entities% [to] (dismount|(dismount|leave) (from|of)] [(any|the[ir]|his|her)] vehicle[s]) [(eject|dismount) (any|the)] passenger[s] (of|from) %entities% 加入的版本: 2.0 Makes an entity ride another entity, e.g. a minecart, a saddled pig, an arrow, etc. 示例: make the player ride a saddled pig make the attacker ride the victim
Expressions
Njol.ch » Projects » Skript Yggdrasil Markup » Documentation Tutorial API Statistics » Skript: ExpressionsEventsConditionsEffectsExpressionsLoopsCustom CommandsTypesTextVariables Table of Contents Altitude Amount Amount of Items Argument Arithmetic Armour Slot Attacked Attacker Bed Biome Block Block Sphere Blocks Blocks in Region Chunk Clicked Block/Entity Colour of Coloured / Uncoloured Command Command Sender Compass Target Console Coordinate Creature/Entity/Player/Projectile/Villager/Powered Creeper/etc. Damage Damage Cause Data Value Difference Direction Distance Drops Element of Enchantment Level Ender Chest Entities Experience Facing Food Level Former/Future State Furnace Slot Game Mode Hash Head location Health Id Index Of Inventory IP Item Items Items In Join & Split Last Spawned/Shot Entity Length Level Level Progress Light Level Location Location At Location Of Loop value Lore Max Health Maximum Stack Size Me Message Money Name / Display Name Named Item Now Numbers Parse Parse Error Passenger Prefix/Suffix Random Random Number Region Region Members & Owners Regions At Remaining Air Rounding Script Name Shooter Sign Text Skull Spawn Speed Subtext Target Targeted Block Time Tool Type of UUID Vehicle Version Weather World Worlds X of Item Yaw / Pitch Filter for version:
=>
Expressions are syntax elements that represent a certain object, e.g. a player or a number, or multiple objects, e.g. the server's worlds or a list of blocks. Expressions can be used anywhere where Skript expects a value, e.g. in set {var} to <value> or teleport <entity expression> to <location expression>. The other possibility for values is to use a static value, e.g. ‘6’ or ‘a pickaxe and a shovel’.
There are basically two kinds of expressions: simple expressions, which are usually one or a few words like ‘player’, ‘world’, or ‘last spawned entity’, and are usually event-dependent, i.e. their value will change depending on the event. The ‘player’ expression for example will hold the current event's player, which depends on which player triggered the event. property expressions, which get a value from another expression, e.g. data value of <item>, altitude of <location>, or <entity>'s world. There are a few exceptions though, e.g. distance between <location> and <location> or the direction expression.
Expressions that represent multiple values can be looped to execute some code for each element of the expression with loop <expression>:. Please refer to the loops page for more information. Advanced Starting with Skript 2.0, expressions can be grouped with parentheses to denote their relation, e.g. set {var} to 10 emeralds and an apple or 5 stone is ambiguous while set {var} to 10 emeralds and (an apple or 5 stone) is not (this particular example will even result in a warning if no brackets are used). You should also use brackets when using lists of expressions inside other expressions, e.g. all players in "world" and "world_nether" should be written as all players in ("world" and "world_nether"), as otherwise it might be parsed as (all players in "world") and ("world_nether"). Altitude patterns[?]: [the] altitude[s] of %locations% %locations%'[s] altitude[s] since: 1.4.3 Effectively an alias of 'y-coordinate of …', it represents the height of some object above bedrock. examples: on damage: altitude of the attacker is higher that the altitude of the victim set damage to damage * 1.25 Amount patterns[?]: (amount|number|size) of %objects% since: 1.0 The amount of something. Please note that amount of <items> will not return the number of items, but the number of stacks, e.g. 1 for a stack of 64 torches. examples: message "There are %number of all players% players online!" Amount of Items patterns[?]: [the] (amount|number) of %item types% (in|of) %inventories% since: 2.0 Counts how many of a particular item type are in a given inventory. examples: message "You have %number of ores in the player's inventory% ores in your inventory." Argument patterns[?]: [the] last arg[ument][s] [the] arg[ument][s](-| )<(d+)> [the] <(d*1)st|(d*2)nd|(d*3)rd|(d*[4-90])th> arg[ument][s] [the] arg[ument][s] [the] %*type%( |-)arg[ument][( |-)<d+>] [the] arg[ument]( |-)%*type%[( |-)<d+>] since: 1.0 Only available in command events. Holds the value of the nth argument given to the command, e.g. if the command "/tell " is used like "/tell Njol Hello Njol!", argument 1 is the player named "Njol" and argument 2 is "Hello Njol!". One can also use the type of the argument instead of its index to address the argument, e.g. in the above example 'player-argument' is the same as 'argument 1'. examples: give the item-argument to the player-argument damage the player-argument by the number-argument give a diamond pickaxe to the argument add argument 1 to argument 2 heal the last argument Arithmetic patterns[?]: %number%[ ]+[ ]%number% %number%[ ]-[ ]%number% %number%[ ]*[ ]%number% %number%[ ]/[ ]%number% %number%[ ]^[ ]%number% since: 1.4.2 Arithmetic expressions, e.g. 1+2, (2 - health of player)/3, etc. Available operands are addition (+), subtraction (-), multiplication (*), division (/), and exponentiation (^). Negation is not available yet, use 0 - expr instead. examples: set the player's health to 10 - the player's health loop (argument + 2)/5 times: message "Two useless numbers: %loop-num*2 - 5%, %2^loop-num - 1%" message "You have %health of player * 2% half hearts of HP!" Armour Slot patterns[?]: [the] (boot[s]|shoe[s]|leg[ging][s]|chestplate[s]|helm[et][s]) [slot] of %living entities% %living entities%'[s] (boot[s]|shoe[s]|leg[ging][s]|chestplate[s]|helm[et][s]) [slot] since: 1.0 A part of a player's armour, i.e. the boots, leggings, chestplate or helmet. As of Skript 2.1 this expression can be used for mobs as well, e.g. to equip zombies with armour. examples: set chestplate of the player to a diamond chestplate helmet of player is neither a helmet nor air # player is wearing a block, e.g. from another plugin Attacked patterns[?]: [the] (attacked|damaged|victim) [<(.+)>] since: 1.3 The victim of a damage event, e.g. when a player attacks a zombie this expression represents the zombie. examples: on damage: victim is a creeper damage the attacked creeper by 1 heart Attacker patterns[?]: [the] (attacker|damager) since: 1.3 The attacker of a damage event, e.g. when a player attacks a zombie this expression represents the player. Please note that the attacker can also be a block, e.g. a cactus or lava, but this expression will not be set in these cases. examples: on damage: attacker is a player health of attacker is less than or equal to 2 damage victim by 1 heart Bed patterns[?]: [the] bed[s] [location[s]] of %players% %players%'[s] bed[s] [location[s]] since: 2.0 The bed location of a player, i.e. the spawn point of a player if he ever slept in a bed and the bed still exists and is unobstructed. examples: bed of player exists: teleport player the the player's bed else: teleport the player to the world's spawn point Biome patterns[?]: [the] biome (of|%direction%) %location% %location%'[s] biome since: 1.4.4 The biome at a certain location. Please note that biomes are only defined for x/z-columns, i.e. the altitude (y-coordinate) doesn't matter. examples:
- damage player in deserts constantly
every real second: loop all players: biome at loop-player is desert damage the loop-player by 1 Block patterns[?]: [the] [event-]block [the] block %direction% [%location%] since: 1.0 The block involved in an event, e.g. the clicked block or the placed block. Can optionally include a direction as well, e.g. 'block above' or 'block in front of the player'. examples: block is ore set block below to air spawn a creeper above the block loop blocks in radius 4: loop-block is obsidian set loop-block to water block is a chest: clear the inventory of the block Block Sphere patterns[?]: [(all|the)] blocks in radius %number% [(of|around) %location%] [(all|the)] blocks around %location% in radius %number% since: 1.0 All blocks in a sphere around a center, mostly useful for looping. examples: loop blocks in radius 5 around the player: set loop-block to air set all blocks in radius 5 around the player to air Blocks patterns[?]: [the] blocks %direction% [%locations%] [the] blocks from %location% [on] %direction% [the] blocks from %block% to %block% [the] blocks between %block% and %block% since: 1.0 Blocks relative to other blocks or between other blocks. Can be used to get blocks relative to other blocks or for looping. examples: loop blocks above the player: loop blocks between the block below the player and the targeted block: set the blocks below (the player, the victim and the targeted block) to air Blocks in Region patterns[?]: cannot be used directly since: 2.1 All blocks in a region. This expression requires a supported regions plugin to be installed. examples: loop all blocks in the region {arena.%{faction.%player%}%}: clear the loop-block Chunk patterns[?]: [the] chunk[s] (of|%directions%) %locations% %locations%'[s] chunk[s] since: 2.0 The chunk a block, location or entity is in. examples: add the chunk at the player to {protected chunks::*} Clicked Block/Entity patterns[?]: [the] clicked (block|%*item type/entity type%) since: 1.0 Only available in click events: Represents the clicked block or entity. examples: message "You clicked on a %type of clicked entity%!" clicked block is a chest: show the inventory of the clicked block to the player Colour of patterns[?]: [the] colo[u]r[s] of %item stacks/entities% %item stacks/entities%'[s] colo[u]r[s] since: 1.2 The colour of an item, can also be used to colour chat messages with "<%colour of ...%>this text is coloured!". examples: on click on wool: message "This wool block is <%colour of block%>%colour of block%<reset>!" set the colour of the block to black Coloured / Uncoloured patterns[?]: (colo[u]r-|colo[u]red )%texts% (un|non)[-](colo[u]r-|colo[u]red )%texts% since: 2.0 Parses <colour>s (including chat styles) in a message or removes any colours & chat styles from the message. This expression replaces localised colours & chat styles, i.e. it doesn't replace english ones, which makes it appropriate to colour command arguments and chat messages. examples: on chat: set message to coloured message command /fade <player>: trigger: set display name of the player-argument to uncoloured display name of the player-argument Command patterns[?]: [the] (full|complete|whole) command [the] command [label] [the] arguments since: 2.0 The command that caused an 'on command' event (excluding the leading slash and all arguments). Use 'full command' for the command including arguments, or 'arguments' for the arguments only. Please note that this event is not adequate for creating custom commands. See the article on custom commands to find out how to define new commands. examples:
- prevent any commands except for the /exit command during some game
on command: {game.%player%.is playing} is true command is not "exit" message "You're not allowed to use commands during the game" cancel the event Command Sender patterns[?]: [the] [command['s]] (sender|executor) since: 2.0 The player or the console who sent a command. Mostly useful in commands and command events. examples: make the command sender execute "/say hi!" on command: log "%executor% used command /%command% %arguments%" to "commands.log" Compass Target patterns[?]: [the] compass target of %players% %players%'[s] compass target since: 2.0 The location a player's compass is pointing at. Please note that wile you can set a player's compass target to an entity, it will actually be set to the location of the entity at the time when the effect is executed, and thus the compass won't automatically follow the entity. examples:
- make all player's compasses target a player stored in {compass target.%player%}
every 5 seconds: loop all players: set the loop-player's compass target to location of {compass target.%loop-player%} Console patterns[?]: [the] (console|server) since: 1.3.1 Represents the server's console which can receive messages and execute commands. examples: execute console command "/stop" send "message to console" to the console Coordinate patterns[?]: [the] (x|y|z)(-| )(coord[inate]|pos[ition]|loc[ation])[s] of %locations% %locations%'[s] (x|y|z)(-| )(coord[inate]|pos[ition]|loc[ation])[s] since: 1.4.3 Represents a given coordinate of a location. examples: player's y-coordinate is smaller than 40: message "Watch out for lava!" Creature/Entity/Player/Projectile/Villager/Powered Creeper/etc. patterns[?]: [the] [event-]<.+> since: 1.0 The entity involved in an event (an entity is a player, a creature or an inanimate object like ignited TNT, a dropped item or an arrow). You can use the specific type of the entity that's involved in the event, e.g. in a 'death of a creeper' event you can use 'the creeper' instead of 'the entity'. examples: give a diamond sword of sharpness 3 to the player kill the creeper kill all powered creepers in the wolf's world projectile is an arrow Damage patterns[?]: [the] damage since: 1.3.5 How much damage is done in a damage event, possibly ignoring armour, criticals and/or enchantments. Can be changed (remember that in Skript '1' is one full heart, not half a heart). examples: increase the damage by 2 Damage Cause patterns[?]: [the] damage (cause|type) since: 2.0 The damage cause of a damage event. Please click on the link for more information. examples: damage cause is lava, fire or burning Data Value patterns[?]: [the] ((data|damage)[s] [value[s]]|durabilit(y|ies)) of %item stacks/slots% %item stacks/slots%'[s] ((data|damage)[s] [value[s]]|durabilit(y|ies)) since: 1.2 The data value of an item. You usually don't need this expression as you can check and set items with aliases easily, but this expression can e.g. be used to "add 1 to data of <item>", e.g. for cycling through all wool colours. examples: add 1 to the data value of the clicked block Difference patterns[?]: difference (between|of) %object% and %object% since: 1.4 The difference between two values, e.g. numbers, dates or times. Use distance for locations. examples: difference between {command.%player%.lastuse} and now is smaller than a minute:
message "You have to wait a minute before using this command again!" stop
Direction patterns[?]: [%number% [(north[(east|west)][(south[(east|west)][(east|west)[(above|over|up|down)[ward(below|under[neath]|beneath) [%direction%] [%number% [[(direction|horizontal direction|facing|horizontal facing) of %entity/block% (of|from)] [%number% [[(direction|horizontal direction|facing|horizontal facing) (of|from)] [%number% [(in[ ]front [of]|forward[s]|behind|backwards|right|left) [of]) [%number% [(in[ ]front [of]|forward[s]|behind|backwards|right|left) [of]) since: 1.0 (basic), 2.0 (extended) A helper expression for the direction type. examples: thrust the player upwards set the block behind the player to water loop blocks above the player: set {_rand} to a random integer between 1 and 10 set the block {_rand} meters south east of the loop-block to stone block in horizontal facing of the clicked entity from the player is air spawn a creeper 1.5 meters horizontally behind the player spawn a TNT 5 meters above and 2 meters horizontally behind the player thrust the last spawned TNT in the horizontal direction of the player with speed 0.2 push the player upwards and horizontally forward at speed 0.5 push the clicked entity in in the direction of the player at speed -0.5 open the inventory of the block 2 blocks below the player to the player teleport the clicked entity behind the player grow a regular tree 2 meters horizontally behind the player Distance patterns[?]: [the] distance between %location% and %location% since: 1.0 The distance between two points, measured in meters (i.e. blocks). Like in other expressions, the location of a block is understood to be at its center, while the location of an entity is usually at its feet. examples: distance between the player and {%player%.home} is smaller than 20: message "You're very close to your home!" Drops patterns[?]: [the] drops since: 1.0 Only available in death events: Represents the drops of the dying creature. Drops can be prevented from dropping by removing them with "remove ... from drops", e.g. "remove all pickaxes from the drops", or "clear drops" if you don't want any drops at all. examples: clear drops remove 4 planks from the drops Element of patterns[?]: ([the] first|[the] last|[a] random) element [out] of %objects% since: 2.0 The first, last or a random element of a set, e.g. a list variable. See also: random examples: give a random element out of {free items::*} to the player Enchantment Level patterns[?]: [the] (%enchantment% level|level of [[the] enchant[ment]] %enchantment%) o(f|n) %item types% %item types%'[s] (%enchantment% level|level of [[the] enchant[ment]] %enchantment%) since: 2.0 The level of a particular enchantment on an item examples: player' tool is a sword of sharpness: message "You have a sword of sharpness %level of sharpness of the player's tool% equipped" Ender Chest patterns[?]: [the] ender[ ]chest[s] of %players% %players%'[s] ender[ ]chest[s] since: 2.0 The ender chest of a player. This can be used wherever an inventory can be used, in particular its items can be modified, and it can be shown to any player (not only the owning player). examples: open the player's ender chest to the player Entities patterns[?]: [all] %*entity types% [(in|of) [world[s]] %worlds%] [all] entities of type[s] %entity types% [(in|of) [world[s]] %worlds%] [all] %*entity types% (within|[with]in radius) %number% [(block[s]|met(er|re)[s])] (of|around) %location% [all] entities of type[s] %entity types% in radius %number% (of|around) %location% since: 1.2.1 All entities in all world, in a specific world or in a radius around a certain location, e.g. 'all players', 'all creepers in the player's world', or 'players in radius 100 of the player'. examples: kill all creepers in the player's world send "Psst!" to all players witin 100 meters of the player give a diamond to all ops heal all tamed wolves in radius 2000 around {town center} Experience patterns[?]: [the] [(spawned|dropped)] [e]xp[erience] [orb[s]] since: 2.1 How much experience was spawned in an experience spawn event. Can be changed. examples: on experience spawn: add 5 to the spawned experience Facing patterns[?]: [the] [horizontal] facing of %living entities/blocks% %living entities/blocks%'[s] [horizontal] facing since: 1.4 The facing of an entity or block, i.e. exactly north, south, east, west, up or down (unlike direction which is the exact direction, e.g. '0.5 south and 0.7 east') examples:
- makes a bridge
loop blocks from the block below the player in the horizontal facing of the player: set block to cobblestone Food Level patterns[?]: [the] (food|hunger)[[ ](level|met(er|re)|bar)] [of %player%] %player%'[s] (food|hunger)[[ ](level|met(er|re)|bar)] since: 1.0 The food level of a player from 0 to 10. Has several aliases: food/hunger level/meter/bar. examples: set the player's food level to 10 Former/Future State patterns[?]: [the] (former|past|old) [state] [of] %~object% %~object% before [the event] [the] (future|to-be|new) [state] [of] %~object% %~object%(-to-be| after[(wards| the event)]) since: 1.1 Represents the value of an expression before an event happened or the value it will have directly after the event, e.g. the old or new level respectively in a level change event. Note: The past, future and present states of an expression are sometimes called 'time states' of an expression. Note 2: If you don't specify whether to use the past or future state of an expression that has different values, its default value will be used which is usually the value after the event. examples: on teleport: former world was "world_nether" # or 'world was' world will be "world" # or 'world after the event is' on tool change: past tool is an axe the tool after the event will be air on weather change: set {weather.%world%.old} to past weather set {weather.%world%.current} to the new weather Furnace Slot patterns[?]: [the] (ore|fuel|result)[s] [slot[s]] of %blocks% %blocks%'[s] (ore|fuel|result)[s] [slot[s]] since: 1.0 A slot of a furnace, i.e. either the ore, fuel or result slot. Remember to use 'block' and not 'furnace', as 'furnace' is not an existing expression. examples: set the fuel slot of the clicked block to a lava bucket set the block's ore slot to 64 iron ore give the result of the block to the player clear the result slot of the block Game Mode patterns[?]: [the] game[ ]mode of %players% %players%'[s] game[ ]mode since: 1.0 The game mode of a player, which can be either survival, creative, or adventure. examples: player's gamemode is survival set the player's gamemode to creative Hash patterns[?]: [md5][( |-)hash(ed|[( |-)]code] of) %texts% since: 2.0 Hashes the given text using the MD5 algorithm. This is useful for storing passwords or IP addresses without having to store them literally. Please note that an MD5 hash is irreversible, i.e. you won't be able to get the original text back (which is the point of storing passwords like this). Brute force and rainbow table attacks can still be performed on hashes though which can easily crack short or insecure passwords. examples: command /setpass <text>: trigger: set {password.%player%} to hashed text-argument command /login <text>: trigger: {password.%player%} is hashed text-argument: message "login successful." else: message "wrong password!" Head location patterns[?]: [the] (head|eye[s]) [location[s]] of %living entities% %living entities%'[s] (head|eye[s]) [location[s]] since: 2.0 The location of an entity's head, mostly useful for players and e.g. looping blocks in the player's line of sight. Please note that this location is only accurate for entities whose head is exactly above their center, i.e. players, endermen, zombies, skeletons, etc., but not sheep, pigs or cows. examples: set the block at the player's head to air set the block in front of the player's eyes to glass loop blocks in front of the player's head: Health patterns[?]: [the] health of %living entities% %living entities%'[s] health since: 1.0 The health of a creature, e.g. a player, mob, villager, etc. from 0 to the creature's max health, e.g. 10 for players. examples: message "You have %health% HP left." Id patterns[?]: [the] id[s] of %item type% %item type%'[s] id[s] since: 1.0 The id of a specific item. You usually don't need this expression as you can likely do everything with aliases. examples: message "the ID of %type of the clicked block% is %id of the clicked block%." Index Of patterns[?]: [the] [(first|last)] index of %text% in %text% since: 2.1 The first of last index of a character (or text) in a text, or -1 if it doesn't occur in the text. Indices range from 1 to the length of the text. examples: set {_@} to the first index of "@" in the text argument if {_s} contains "abc": set {_s} to the first (index of "abc" in {_s} + 3) characters of {_s} # removes everything after the first "abc" from {_s} Inventory patterns[?]: [the] inventor(y|ies) of %inventoryholders% %inventoryholders%'[s] inventor(y|ies) since: 1.0 The inventory of a block or player. You can usually omit this expression and can directly add or remove items to/from blocks or players. examples: add a plank to the player's inventory clear the player's inventory remove 5 wool from the inventory of the clicked block IP patterns[?]: IP[s][( |-)address[es]] of %players% %players%'[s] IP[s][( |-)address[es]] since: 1.4 The IP address of a player. examples: IP-ban the player # is equal to the next line ban the IP-address of the player broadcast "Banned the IP %IP of player%" Item patterns[?]: [the] item since: unknown The item involved in an event, e.g. in a drop, dispense, pickup or craft event. examples: on dispense: item is a clock set the time to 6:00 Items patterns[?]: [(all|every)] item(s|[ ]types) items of type[s] %item types% [(all|every)] block(s|[ ]types) blocks of type[s] %item types% since: unknown Items or blocks of a specific type, useful for looping. examples: loop items of type ore and log: block contains loop-item message "There's at least one %loop-item% in this block" stop loop drop all blocks at the player # drops one of every block at the player Items In patterns[?]: [all] items (inventor(y|ies)) %inventories% since: 2.0 All items in an inventory. Useful for looping or storing in a list variable. Please note that the positions of the items in the inventory are not saved, only their order is preserved. examples: loop all items in the player's inventory: loop-item is enchanted remove loop-item from the player set {inventory.%player%::*} to items in the player's inventory Join & Split patterns[?]: (concat[enate]|join) %texts% [(with|using|by) [[the] delimiter] %text%] split %text% (at|using|by) [[the] delimiter] %text% %text% [split] (at|using|by) [[the] delimiter] %text% since: 2.1 Joins several texts with a common delimiter (e.g. ", "), or splits a text into multiple texts at a given delimiter. examples: message "Online players: %join all players with " | "%" # %all players% would use the default "x, y, and z" set {_s::} to the string argument split at "," Last Spawned/Shot Entity patterns[?]: [the] [last[ly]] (spawned|shot) %*entity type% since: 1.3 (spawned entity), 2.0 (shot entity) Holds the entity that was spawned most recently with the spawn effect, or shot with the shoot effect. Please note that even though you can spawn multiple mobs simultaneously (e.g. with 'spawn 5 creepers'), only the last spawned mob is saved and can be used. If you spawn an entity and shoot a projectile you can however access both. examples: spawn a priest set {%spawned priest%.healer} to true shoot an arrow from the last spawned entity ignite the shot projectile Length patterns[?]: [the] length of %texts% %texts%'[s] length since: 2.1 The length of a text, in number of characters. examples: set {_l} to length of the string argument Level patterns[?]: [the] level of %players% %players%'[s] level since: unknown The level of a player. examples: reduce the victim's level by 1 set the player's level to 0 Level Progress patterns[?]: [the] level progress of %players% %players%'[s] level progress since: 2.0 The progress a player has made until the next level. Remember that this value is between 0 and 1, not 0 and 100! Changing this value can cause a player's level to change if the resulting level progess is negative or larger than 1, e.g.increase the player's level progress by 0.5 will make the player gain a level if his progress was more than 50%. examples:
- use the exp bar as mana
on rightclick with a blaze rod: player's level progress is larger than 0.2 shoot a fireball from the player reduce the player's level progress by 0.2 every 2 seconds: loop all players: level progress of loop-player is smaller than 0.9: increase level progress of the loop-player by 0.1 else: set level progress of the loop-player to 0.99 on xp spawn: cancel event Light Level patterns[?]: [(sky|sun|block)[ ]]light[ ]level [(of|%direction%) %location%] since: 1.3.4 Gets the light level at a certain location which ranges from 0 to 15. It can be separated into sunlight (15 = direct sunlight, 1-14 = indirect) and block light (torches, glowstone, etc.). The total light level of a block is the maximum of the two different light types. examples:
- set vampire players standing in bright sunlight on fire
every 5 seconds: loop all players: {vampire.%loop-player%} is true sunlight level at the loop-player is greater than 10 ignite the loop-player for 5 seconds Location patterns[?]: [the] [event-](location|position) [the] (location|position) %direction% [%location%] since: 2.0 The location where an event happened (e.g. at an entity or block), or a location relative to another (e.g. 1 meter above another location). examples: drop 5 apples at the event-location # exactly the same as writing 'drop 5 apples' set {_loc} to the location 1 meter above the player Location At patterns[?]: [the] (location|position) [at] [(][x[ ][=[ ]]]%number%, [y[ ][=[ ]]]%number%, [and] [z[ ][=[ ]]]%number%[)] [[(in|of) [[the] world]] %world%] since: 2.0 Allows to create a location from three coordinates and a world. This expression is currently not parsed correctly, and there is no ETA on a fix yet. examples: set {_loc} to the location at arg-1, arg-2, arg-3 of the world arg-4 distance between the player and the location (0, 0, 0) is less than 200 Location Of patterns[?]: (location|position) of %location% %location%'[s] (location|position) since: unknown The location of a block or entity. This not only represents the x, y and z coordinates of the location but also includes the world and the direction an entity is looking (e.g. teleporting to a saved location will make the teleported entity face the same saved direction every time). Please note that the location of an entity is at its feet, use the head location to get the location of the head. examples: set {home.%player%} to the location of the player message "Your home was set to %player's location% in %player's world%." Loop value patterns[?]: [the] loop-<.+> since: 1.0 The currently looped value. examples:
- countdown:
loop 10 times: message "%11 - loop-number%" wait a second
- generate a 10x10 floor made of randomly coloured wool below the player:
loop blocks from the block below the player to the block 10 east of the block below the player: loop blocks from the loop-block to the block 10 north of the loop-block: set loop-block-2 to any wool Lore patterns[?]: [the] line %number% of [the] lore of [%item stack/item type%] [the] line %number% of %item stack/item type%'[s] lore [the] %number%(st|nd|rd|th) line of [the] lore of [%item stack/item type%] [the] %number%(st|nd|rd|th) line of %item stack/item type%'[s] lore since: 2.1 An item's lore. examples: set the 1st line of the item's lore to "<orange>Excalibur 2.0" Max Health patterns[?]: [the] max[imum] health of %living entities% %living entities%'[s] max[imum] health since: 2.0 The maximum health of an entity, e.g. 10 for a player examples: on join: set the maximum health of the player to 100 spawn a giant set the last spawned entity's max health to 1000 Maximum Stack Size patterns[?]: [the] max[imum] stack[[ ]size] of %item stack% %item stack%'[s] max[imum] stack[[ ]size] since: 2.1 The maximum stack size of the specified material, e.g. 64 for torches, 16 for buckets, and 1 for swords. examples: send "You can only pick up %max stack size of player's tool% of %type of (player's tool)%" to player Me patterns[?]: me my[self] since: 2.1.1 A 'me' expression that can be used in effect commands only. examples: !heal me !kick myself !give a diamond axe to me Message patterns[?]: [the] [chat( |-)]message [the] (join|log[ ]in)( |-)message [the] (quit|leave|log[ ]out|kick)( |-)message [the] death( |-)message since: 1.4.6 (chat message), 1.4.9 (join & quit messages), 2.0 (death message) The (chat) message of a chat event, the join message of a join event, the quit message of a quit event, or the death message on a death event. This expression is mostly useful for being changed. examples: on chat: player has permission "admin" set message to "<red>%message%"
on first join: set join message to "Welcome %player% to our awesome server!" on join: player has played before set join message to "Welcome back, %player%!"
on quit: set quit message to "%player% left this awesome server!"
on death: set the death message to "%player% died!" Money patterns[?]: cannot be used directly since: 2.0 How much virtual money a player has (can be changed).
Like all economy elements, this expression requires that Vault and a compatible economy plugin is installed. examples: message "You have %player's money%" # the currency name will be added automatically remove 20$ from the player's balance # replace '$' by whatever currency you use add 200 to the player's account # or omit the currency alltogether Name / Display Name patterns[?]: [the] (player|tab)[ ]list name[s] of %players% %players%'[s] (player|tab)[ ]list name[s] [the] (display|nick|chat)[ ]name[s] of %slots/item stacks/living entities/players% %slots/item stacks/living entities/players%'[s] (display|nick|chat)[ ]name[s] [the] name[s] of %slots/item stacks/living entities/players% %slots/item stacks/living entities/players%'[s] name[s] since: 1.4.6 (players' name & display name), unknown (player list name), 2.0 (item name) Represents a player's minecraft account name, chat display name, or playerlist name, or the custom name of an item or a living entity.
The differences between the different names are: name: Minecraft account name of a player (unmodifiable), or the custom name of an item or mob (modifiable). display name: The name of a player as displayed in the chat. This name can be changed freely and can include colour codes, and is shared among all plugins (e.g. chat plugins will use a changed name). tab list name: The name of a player used in the player list that usually opens with the tab key. Please note that this is limited to 16 characters, including colour codes which are counted as 2 characters each, and that no two players can have the same tab list name at the same time. Starting with Skript 2.1, the name and display name of entities have a different meaning: 'Name' sets the entity's name like a name tag does, while 'display name' will not only set the entity's name, but will also make it visible through blocks just like players' names. examples: on join: player has permission "name.red" set the player's display name to "<red>[admin]<gold>%name of player%" set the player's tablist name to "<green>%name of player%" set the name of the player's tool to "Legendary Sword of Awesomeness" Named Item patterns[?]: %item types% (named|with name[s]) %text% since: 2.0 Directly names an item, useful for defining a named item in a script. If you want to (re)name existing items you can either use this expression or use set name of <item> to <text>. examples: give a diamond sword of sharpness 100 named "<gold>Excalibur" to the player set tool of player to the player's tool named "<gold>Wand" set the name of the player's tool to "<gold>Wand" Now patterns[?]: now since: 1.4 The current system time of the server. Use time to get the Minecraft time of a world. examples: broadcast "Current server time: %now%" Numbers patterns[?]: [(integers) (between|from) %number% (and|to) %number% %number% times since: 1.4.6 All numbers between two given numbers, useful for looping. Use 'numbers' if your start is not an integer and you want to keep the fractional part of the start number constant, or use 'integers' if you only want to loop integers. An integer loop from 1 to a number x can also be written as 'loop x times'. examples: loop 5 times: # loops 1, 2, 3, 4, 5 loop numbers from 2.5 to 5.5: # loops 2.5, 3.5, 4.5, 5.5 loop integers from 2.9 to 5.1: # same as '3 to 5', i.e. loops 3, 4, 5 Parse patterns[?]: %text% parsed as (%*type%|"<.*>") since: 2.0 Parses text as a given type, or as a given pattern. This expression can be used in two different ways: One which parses the entire text as a single instance of a type, e.g. as a number, and one that parses the text according to a pattern. If the given text could not be parsed, this expression will return nothing and the parse error will be set if some information is available. Some notes about parsing with a pattern: - The pattern must be a Skript pattern, e.g. percent signs are used to define where to parse which types, e.g. put a %number% or %items% in the pattern if you expect a number or some items there. - You have to save the expression's value in a list variable, e.g. set {parsed::*} to message parsed as "...". - The list variable will contain the parsed values from all %types% in the pattern in order. If a type was plural, e.g. %items%, the variable's value at the respective index will be a list variable, e.g. the values will be stored in {parsed::1::*}, not {parsed::1}. examples: set {var} to line 1 parsed as number on chat: set {var::*} to message parsed as "buying %items% for %money%" if parse error is set: message "%parse error%" else if {var::*} is set: cancel event remove {var::2} from the player's balance give {var::1::*} to the player Parse Error patterns[?]: [the] [last] [parse] error since: 2.0 The error which caused the last parse operation to fail, which might not be set if a pattern was used and the pattern didn't match the provided text at all. examples: set {var} to line 1 parsed as integer if {var} is not set: parse error is set: message "<red>Line 1 is invalid: %last parse error%" else: message "<red>Please put an integer on line 1!" Passenger patterns[?]: [the] passenger[s] of %entities% %entities%'[s] passenger[s] since: 2.0 The passenger of a vehicle, or the rider of a mob.
See also: vehicle (expression), vehicle (effect) examples: passenger of the minecart is a creeper or a cow the saddled pig's passenger is a player Prefix/Suffix patterns[?]: cannot be used directly since: 2.0 The prefix or suffix as defined in the server's chat plugin. examples: on chat: cancel event broadcast "%player's prefix%%player's display name%%player's suffix%: %message%" to the player's world set the player's prefix to "[<red>Admin<reset>] " Random patterns[?]: [a] random %*type% [out] of %objects% since: 1.4.9 Gets a random item out of a set, e.g. a random player out of all players online. examples: give a diamond to a random player out of all players give a random item out of all items to the player Random Number patterns[?]: [a] random (integer|number) (from|between) %number% (to|and) %number% since: 1.4 A random number or integer between two given numbers. Use 'number' if you want any number with decimal parts, or use use 'integer' if you only want whole numbers. Please note that the order of the numbers doesn't matter, i.e. random number between 2 and 1 will work as well as random number between 1 and 2. examples: set the player's health to a random number between 5 and 10 send "You rolled a %random integer from 1 to 6%!" to the player Region patterns[?]: cannot be used directly since: 2.1 The region involved in an event. This expression requires a supported regions plugin to be installed. examples: on region enter: region is {forbidden region} cancel the event Region Members & Owners patterns[?]: cannot be used directly since: 2.1 A list of members or owners of a region. This expression requires a supported regions plugin to be installed. examples: on entering of a region: message "You're entering %region% whose owners are %owners of region%". Regions At patterns[?]: cannot be used directly since: 2.1 All regions at a particular location. This expression requires a supported regions plugin to be installed. examples: On click on a sign: line 1 of the clicked block is "[region info]" set {_regions::*} to regions at the clicked block if {_regions::*} is empty: message "No regions exist at this sign." else: message "Regions containing this sign: <gold>%{_regions::*}%<r>." Remaining Air patterns[?]: [the] remaining air of %living entities% %living entities%'[s] remaining air since: unknown How much time a player has left underwater before starting to drown. examples: player's remaining air is less than 3 seconds: send "hurry, get to the surface!" to the player Rounding patterns[?]: floor(%number%) [(a|the)] round[ed] down %number% round(%number%) [(a|the)] round[ed] %number% ceil[ing](%number%) [(a|the)] round[ed] up %number% since: 2.0 Rounds numbers normally, up (ceiling) or down (floor) respectively. examples: set {var} to rounded health of player set line 1 of the block to round(1.5 * player's level) set {_x} to floor({_y}) - ceil({_x}) add rounded down argument to the player's health Script Name patterns[?]: [the] script[['s] name] since: 2.0 Holds the current script's name (the file name without '.sk'). examples: on script load: set {running.%script%} to true on script unload: set {running.%script%} to false Shooter patterns[?]: [the] shooter [of %projectile%] since: 1.3.7 The shooter of a projectile. As of Skript 2.1, this can be changed to fake the shooter of the projectile. examples: shooter is a skeleton add 1 to {game.points.%shooter of {game.ball}%} Sign Text patterns[?]: [the] line %number% [of %block%] [the] (1st|first|2nd|second|3rd|third|4th|fourth) line [of %block%] since: 1.3 A line of text on a sign. Can be changed, but remember that there is a 16 character limit per line (including colour codes that use 2 characters each). examples: on rightclick on sign: line 2 of the clicked block is "[Heal]": heal the player set line 3 to "%player%" Skull patterns[?]: [the] skull of %offline players/entities/entity types% %offline players/entities/entity types%'[s] skull since: 2.0 Gets a skull item representing a player or an entity. examples: give the victim's skull to the attacker set the block at the entity to the entity's skull Spawn patterns[?]: [the] spawn[s] [(point|location)[s]] [of %worlds%] %worlds%'[s] spawn[s] [(point|location)[s]] since: 1.4.2 The spawnpoint of a world. examples: teleport all players to spawn set the spawn point of "world" to the player's location Speed patterns[?]: [the] (walk[ing]|fl(y[ing]|ight))[( |-])speed of %players% %players%'[s] (walk[ing]|fl(y[ing]|ight))[( |-])speed since: unknown A player's walking or flying speed. Both can be changed, but values must be between -1 and 1 (excessive values will be changed to -1 or 1 respectively). Negative values reverse directions. Please note that changing a player's speed will change his FOV just like potions do. The default values are 0.2 for walk speed, and 0.1 for fly speed. examples: set the player's walk speed to 1 increase the argument's fly speed by 0.1 set the walk speed of the player to 0-(the player's walk speed) # reverses the player's speed Subtext patterns[?]: [the] [(part|sub[ ](text|string)) of %texts% (between|from) (ind(ex|ices)|character[s])] %number% [(and|to) (index|character)] %number% [the] (first|last) [%number%] character[s] of %texts% [the] %number% (first|last) characters of %texts% since: 2.1 Extracts part of a text. You can either get the first <x> characters, the last <x> characters, or the characters between indices <x> and <y>. The indices <x> and <y> should be between 1 and the length of the text (other values will be fit into this range). examples: set {_s} to the first 5 characters of the text argument message "%subtext of {_s} from characters 2 to (the length of {_s} - 1)%" # removes the first and last character from {_s} and sends it to the player or console Target patterns[?]: [the] target[[ed] %*entity type%] [of %living entities%] %living entities%'[s] target[[ed] %*entity type%] since: unknown For players this is the entity at the crosshair, while for mobs and experience orbs it represents the entity they are attacking/following (if any). examples: on entity target:
entity's target is a player send "You're being followed by an %entity%!" to target of entity
Targeted Block patterns[?]: [the] target[ed] block[s] [of %players%] %players%'[s] target[ed] block[s] [the] actual[ly] target[ed] block[s] [of %players%] %players%'[s] actual[ly] target[ed] block[s] since: 1.0 The block at the crosshair. This regards all blocks that are not air as fully opaque, e.g. torches will be like a solid stone block for this expression. examples:
- A command to set the block a player looks at to a specific type:
command /setblock <material>:
trigger: set targeted block to argument
Time patterns[?]: [the] time [(in|of) %worlds%] %worlds%'[s] time since: 1.0 The time of a world. examples: time in world is between 18:00 and 6:00: broadcast "It's night-time, watch out for monsters!" Tool patterns[?]: [the] (tool|held item|weapon) [of %living entities%] %living entities%'[s] (tool|held item|weapon) since: 1.0 The item a player is holding. As of Skript 2.1 this expression can also be used for mobs, e.g. to change the weapon of a zombie. examples: player is holding a pickaxe
- is the same as
player's tool is a pickaxe Type of patterns[?]: [the] type of %entity types/item stacks% %entity types/item stacks%'[s] type since: 1.4 The type of a block, item, or entity. The type of an item is only its id and data value, i.e. it ignores the amount, enchantments etc., and the type of an entity is e.g. 'wolf' or 'player'. examples: on rightclick on an entity: message "This is a %type of clicked entity%!" UUID patterns[?]: [the] UUID of %players/worlds% %players/worlds%'[s] UUID since: 2.1.2 The UUID of a player or world. In the future there will be an option to use a player's UUID instead of the name in variable names (i.e. when %player% is used), but for now this can be used. Please note that this expression does not work for offline players! examples:
- prevents people from joining the server if they use the name of a player
- who has played on this server at least once since this script has been added
on login: {uuids.%name of player%} exists: {uuids.%name of player%} is not UUID of player kick player due to "Someone with your name has played on this server before" else: set {uuids.%name of player%} to UUID of player Vehicle patterns[?]: [the] vehicle[s] of %entities% %entities%'[s] vehicle[s] since: 2.0 The vehicle an entity is in, if any. This can actually be any entity, e.g. spider jockeys are skeletons that ride on a spider, so the spider is the 'vehicle' of the skeleton. See also: passenger examples: vehicle of the player is a minecart Version patterns[?]: ([craft]bukkit|minecraft|skript)( |-)version since: 2.0 The version of Bukkit, Minecraft or Skript respectively. examples: message "This server is running Minecraft %minecraft version% on Bukkit %bukkit version%" message "This server is powered by Skript %skript version%" Weather patterns[?]: [the] weather [(in|of) %worlds%] %worlds%'[s] weather since: 1.0 The weather in the given or the current world. examples: set weather to clear weather in "world" is rainy World patterns[?]: [the] world [of %entity/location%] %entity/location%'[s] world since: 1.0 The world the event occurred in. examples: world is "world_nether" teleport the player to the world's spawn set the weather in the player's world to rain Worlds patterns[?]: [(the|all)] worlds since: 1.0 All worlds of the server, useful for looping. examples: loop all worlds: broadcast "You're in %loop-world%" to loop-world X of Item patterns[?]: %number% of %item stacks/entity type% since: 1.2 An expression to be able to use a certain amount of items where the amount can be any expression. Please note that is expression is not stable and might be replaced in the future. examples: give level of player of pickaxes to the player Yaw / Pitch patterns[?]: [the] (yaw|pitch) of %locations% %locations%'[s] (yaw|pitch) since: 2.0 The yaw or pitch of a location, in degrees. examples: log "%player%: %location of player%, %player's yaw%, %player's pitch%" to "playerlocs.log" About ~ njol.ch created by Peter Güttinger ~ icons by Yusuke Kamiyamane ~ Last modified: Freyja's Day, 9th August 2013, 09:43
Loops
Njol.ch » Projects » Skript Yggdrasil Markup » Documentation Tutorial API Statistics » Skript: LoopsEventsConditionsEffectsExpressionsLoopsCustom CommandsTypesTextVariables A Loop is a construct that repeats code for multiple values. A typical loop looks like this: loop <expression to loop>: <condition(s)> <effect(s)> A loop will loop through all elements of the given expression, e.g. all players, worlds, items, etc. The conditions & effects inside the loop will be executed for every of those elements, which can be accessed with ‘loop-<what>’, e.g. send "hello" to loop-player. When a condition inside a loop is not fulfilled the loop will start over with the next element of the loop. You can however use stop loop to exit the loop completely and resume code execution after the end of the loop.
Simple loops can often be replaced with a single condition or effect by including the looped expression in it, e.g. use give a torch to all players instead of looping all players and giving them a torch individually.
Loopable Values
All expressions that represent more than one value, e.g. ‘all players’, ‘worlds’, etc., as well as list variables, can be looped. You can also use a list of expressions, e.g. loop the victim and the attacker, to execute the same code for only a few values.
List Variables
When looping list variables, you can also use loop-index in addition to loop-value inside the loop. loop-value is the value of the currently looped variable, and loop-index is the last part of the variable's name (the part where the list variable has its asterisk *). The following example will increase all values inside a list variable by one:
loop {var::*}:
set {var::%loop-index%} to loop-value + 1
While Loops
Starting with version 2.0 you can use while loops, i.e. loops that will just keep repeating as long as a condition is met. A while loop looks like this:
while <condition>:
Please be careful with this kind of loop, as it will keep running infinitely if the condition is always met.
About ~ njol.ch created by Peter Güttinger ~ icons by Yusuke Kamiyamane ~
Last modified: Saturn's Day, 15th March 2014, 08:36
Commands
Njol.ch
»
Projects
»
Skript
Yggdrasil
Markup
»
Documentation
Tutorial
API
Statistics
» Skript: Custom CommandsEventsConditionsEffectsExpressionsLoopsCustom CommandsTypesTextVariables
Creating custom commands is not difficult with Skript, but remember that Skript is not suitable for creating aliases of other plugins' commands, only for creating completely new commands, as arguments are parsed differently than how most other plugins do it.
The basic syntax of a custom command definition is a follows:
command /commandname <arguments>: # arguments are explained below
description: A description of what this command does
usage: How to use the command, e.g. /commandname <arguments> # If omitted this defaults to something similar to how the command was defined above.
permission: required.permission.to.use.this.command # If omitted this command can be used by everyone regardless of permissions.
permission message: Message to send if the player doesn't have the required permission to use this command # If omitted this defaults to "You don't have the required permission to use this command"
executable by: players/console/players and console # If omitted this command can be executed by players and the console.
aliases: /c, /comname. # a list of aliases of the command which are usually abbreviations of the command
trigger:
put conditions and effects here that will be checked/executed when the command is used.
A command's arguments look like <argtype> or <argtype = default value>, e.g. <item> or <item=water bucket>. The default value can also be an expression, in which case it has to be put into percent signs: <item=%tool%>.
Arguments can also be mixed with text, e.g. a /give command definition can look like the following:
command /give <items> to <player>:
This command could then be used like /give a diamond to Njol.
You can make parts of the arguments of a command optional by putting them into [square brackets], e.g. a command that finds mobs of a certain type within a given radius can look like command /find <entity type> [in radius <integer=100>]. This command can be used like /find creepers or /find zombies in radius 20, where the radius will default to 100 if omitted.
In the likely case that this was confusing here's a simple example command:
- a simple ID command to get the id of the held item
command /id <item=%tool%>:
description: Find the ID of the item you're holding, or any given one.
usage: /id [type]
executable by: players
trigger:
message "The ID of %arg 1% is %id of arg 1%"
Custom commands can be defined anywhere in a script file – the command basically replaces the event a trigger would normally need. If a command is related to some triggers I recommend to put the command into the same file as the triggers, otherwise put it into whatever file fits best. You could e.g. create a big file that contains all standalone commands, or create a separate file for every command.
The following is an example of a combined trigger/command script which allows you to spawn a healer villager that can heal players for gold:
command /healer:
permission: healer.create
description: spawns a healer villager which can heal players
trigger:
spawn a priest
set {healers::%spawned villager%} to true
set the name of the spawned villager to "Healer"
on rightclick on a priest:
player has permission "healer.use"
player is holding a gold ingot
{healers::%clicked villager%} is true
player's health is below 10
heal the player by 5 hearts
remove 1 gold ingot from the player
About ~ njol.ch created by Peter Güttinger ~ icons by Yusuke Kamiyamane ~
Last modified: Thor's Day, 2nd October 2014, 09:16
type
Njol.ch
»
Projects
»
Skript
Yggdrasil
Markup
»
Documentation
Tutorial
API
Statistics
» Skript: TypesEventsConditionsEffectsExpressionsLoopsCustom CommandsTypesTextVariables
Table of Contents
Biome
Block
Boolean
Chunk
Colour
Command Sender
Damage Cause
Date
Direction
Enchantment
Enchantment Type
Entity
Entity Type
Entity Type with Amount
Experience
Game Mode
Inventory
Inventory Slot
Item / Material
Item Type
Living Entity
Location
Money
Number
Object
Offlineplayer
Player
Potion Effect Type
Projectile
Region
Text
Time
Timeperiod
Timespan
Tree Type
Type
Visual Effect
Weather Type
World
Filter for version:
=>
This is a list of most types that Skript uses (types that are not listed are not needed by the user). A type is a kind of object, e.g. player, number, or text.
Many types can be used as command arguments (‘<type>’, e.g. <number>) and almost all types can be used as loop-values (‘loop-type’, e.g. loop-block). The patterns listed for each type below reference to this.
The usage listed above the patterns for each type describe how you can define an instance of the type in a script, e.g. how to include text properly or how to write a number. The usage does usually not include any expressions that represent an instance of the type, e.g. blocks cannot be defined in a script, but you can use one of the many block expressions to get a block.
Biome
type usage:
swampland, forest, taiga, desert, plains, hell, sky, ocean, river, extreme hills, frozen ocean, frozen river, ice plains, ice mountains, mushroom island, mushroom shore, beach, desert hills, forest hills, taiga hills, small mountains, jungle, jungle hills
type name patterns[?]:
biome[s]
since:
1.4.4
All possible biomes Minecraft uses to generate a world.
examples:
biome at the player is desert
Block
type usage:
cannot be written in scripts
type name patterns[?]:
block[s]
since:
1.0
A block in a world. It has a location and a type, and can also have a direction (mostly a facing), an inventory, or other special properties.
Boolean
type usage:
true/yes/on or false/no/off
type name patterns[?]:
boolean[s]
since:
1.0
A boolean is a value that is either true or false. Other accepted names are 'on' and 'yes' for true, and 'off' and 'no' for false.
examples:
set {config.%player%.use mod} to false
Chunk
type usage:
cannot be written in scripts
type name patterns[?]:
chunk[s]
since:
2.0
A chunk is a cuboid of 16×16×<world height> (x×z×y) blocks (the world height is usually 128 or 256). Chunks are spread on a fixed rectangular grid in their world, where the chunk (0,0) contains the blocks (0,0,0) to (15,15,<world height> - 1).
Colour
type usage:
black, dark grey/dark gray, grey/light grey/gray/light gray/silver, white, blue/dark blue, cyan/aqua/dark cyan/dark aqua, light blue/light cyan/light aqua, green/dark green, light green/lime/lime green, yellow/light yellow, orange/gold/dark yellow, red/dark red, pink/light red, purple/dark purple, magenta/light purple, brown/indigo
type name patterns[?]:
colo[u]r[s]
since:
unknown
Wool, dye and chat colours.
Please note that the same colours are used for chat and wool so that you can use any colour expression to colour chat, e.g. message "<%colour of sheep%>this colour". Minecraft however uses slightly different colours for chat and sheep, with the main difference being that there exists no brown chat colour, but there exists another blue one instead, thus 'brown' and 'indigo' are the same colour.
examples:
color of the sheep is red or black
set the colour of the block to green
message "You're holding a <%color of tool%>%color of tool%<reset> wool block"
Command Sender
type usage:
use the console for the console
see player for players.
type name patterns[?]:
[command[s]][ ](sender|executor)[s]
since:
1.0
A player or the console.
examples:
on command /pm:
command sender is not the console
chance of 10%
give coal to the player
message "You got a piece of coal for sending that PM!"
Damage Cause
type usage:
contact, attack, projectile, suffocation, fall, fire, burning, melting, lava, drowning, block explosion, entity explosion, void, lightning, suicide, starvation, poison, potion, wither, falling block, thorns, unknown
type name patterns[?]:
damage cause[s]
since:
2.0
The cause/type of a damage event, e.g. lava, fall, fire, drowning, explosion, poison, etc.
Please note that support for this type is very rudimentary, e.g. lava, fire and burning, as well as projectile and attack are considered different types.
Date
type usage:
cannot be written in scripts
type name patterns[?]:
date[s]
since:
1.4
A date is a certain point in the real world's time which can currently only be obtained with now.
See time and timespan for the other time types of Skript.
examples:
set {_yesterday} to now
subtract a day from {_yesterday}
- now {_yesterday} represents the date 24 hours before now
Direction
type usage:
see direction (expression)
type name patterns[?]:
direction[s]
since:
2.0
A direction, e.g. north, east, behind, 5 south east, 1.3 meters to the right, etc.
Locations and some blocks also have a direction, but without a length.
Please note that directions have changed extensively in the betas and might not work perfectly. They can also not be used as command arguments.
examples:
set the block below the victim to a chest
loop blocks from the block infront of the player to the block 10 below the player:
set the block behind the loop-block to water
Enchantment
type usage:
protection, respiration, punch, projectile protection, smite, fortune, infinity, feather falling, flame, knockback, sharpness, aqua affinity, looting, fire aspect, silk touch, blast protection, power, thorns, efficiency, fire protection, bane of arthropods, unbreaking, luck of the sea, lure
type name patterns[?]:
enchantment[s]
since:
1.4.6
An enchantment, e.g. 'sharpness' or 'fortune'. Unlike enchantment type this type has no level, but you usually don't need to use this type anyway.
Enchantment Type
type usage:
<enchantment> [<level>]
type name patterns[?]:
enchant(ing|ment) type[s]
since:
1.4.6
An enchantment with an optional level, e.g. 'sharpness 2' or 'fortune'.
examples:
enchant the player's tool with sharpness 5
helmet is enchanted with waterbreathing
Entity
type usage:
player, op, wolf, tamed ocelot, powered creeper, zombie, unsaddled pig, fireball, arrow, dropped item, item frame, etc.
type name patterns[?]:
entit(y|ies)
since:
1.0
An entity is something in a world that's not a block, e.g. a player, a skeleton, or a zombie, but also projectiles like arrows, fireballs or thrown potions, or special entities like dropped items, falling blocks or paintings.
examples:
entity is a zombie or creeper
player is an op
projectile is an arrow
shoot a fireball from the player
Entity Type
type usage:
Detailed usage will be added eventually
type name patterns[?]:
entity[ ]type[s]
since:
1.3
The type of an entity, e.g. player, wolf, powered creeper, etc.
examples:
victim is a cow
spawn a creeper
targeted entity is an enderman holding a rose
spawn 10 red, green or blue sheep
spawn a falling anvil 4 meters above the player
kill all skeleton horses in all worlds
Entity Type with Amount
type usage:
<number> <entity type>
type name patterns[?]:
cannot be used directly
since:
1.3
An entity type with an amount, e.g. '2 zombies'. I might remove this type in the future and make a more general 'type' type, i.e. a type that has a number and a type.
examples:
spawn 5 creepers behind the player
Experience
type usage:
[<number>] ([e]xp|experience)
type name patterns[?]:
cannot be used directly
since:
2.0
Experience points. Please note that Bukkit only allows to give XP, but not remove XP from players. You can however change a player's level and level progress freely.
examples:
give 10 xp to the player
Game Mode
type usage:
creative/survival/adventure
type name patterns[?]:
game[ ]mode[s]
since:
1.0
The game modes survival, creative and adventure.
examples:
player's gamemode is survival
set the player argument's game mode to creative
Inventory
type usage:
cannot be written in scripts
type name patterns[?]:
inventor(y|ies)
since:
1.0
An inventory of a player or block. Inventories have many effects and conditions regarding the items contained.
An inventory has a fixed amount of slots which represent a specific place in the inventory, e.g. the helmet slot for players (Please note that slot support is still very limited but will be improved eventually).
Inventory Slot
type usage:
cannot be written in scripts
type name patterns[?]:
[inventory ]slot[s]
since:
unknown
Represents a single slot of an inventory. Notable slots are the armour slots and furnace slots.
The most important property that distinguishes a slot from an item is its ability to be changed, e.g. it can be set, deleted, enchanted, etc. (Some item expressions can be changed as well, e.g. items stored in variables. Speaking of which: slots are never saved to variables, only the items they represent at the time when the variable is set).
Please note that the tool is a slot, but it can actually change its position, i.e. doesn't always represent the same slot.
examples:
set tool of player to dirt
delete helmet of the victim
set the colour of the player's tool to green
enchant the player's chestplate with projectile protection 5
Item / Material
type usage:
[<number> [of]] <alias> [of <enchantment> <level>], Where <alias> must be an alias that represents exactly one item (i.e cannot be a general alias like 'sword' or 'plant')
type name patterns[?]:
item
material
since:
1.0
An item, e.g. a stack of torches, a furnace, or a wooden sword of sharpness 2. Unlike item type an item can only represent exactly one item (e.g. an upside-down cobblestone stair facing west), while an item type can represent a whole range of items (e.g. any cobble stone stairs regardless of direction).
You don't usually need this type except when you want to make a command that only accepts an exact item.
Please note that currently 'material' is exactly the same as 'item', i.e. can have an amount & enchantments.
examples:
set {_item} to type of the targeted block
{_item} is a torch
Item Type
type usage:
[<number> [of]] [all/every] <alias> [of <enchantment> [<level>] [,/and <more enchantments...>]]
type name patterns[?]:
item[ ]type[s]
items
materials
since:
1.0
An item type is an alias, e.g. 'a pickaxe', 'all plants', etc., and can result in different items when added to an inventory, and unlike items they are well suited for checking whether an inventory contains a certain item or whether a certain item is of a certain type.
An item type can also have one or more enchantments with or without a specific level defined, and can optionally start with 'all' or 'every' to make this item type represent all types that the alias represents, including data ranges.
examples:
give 4 torches to the player
add all slabs to the inventory of the block
player's tool is a diamond sword of sharpness
remove a pickaxes of fortune 4 from {stored items::*}
set {_item} to 10 of every upside-down stair
block is dirt or farmland
Living Entity
type usage:
see entity, but ignore inanimate objects
type name patterns[?]:
living[ ]entit(y|ies)
since:
1.0
A living entity, e.g. a mob or player, not inanimate entities like projectiles or dropped items.
examples:
spawn 5 powered creepers
shoot a zombie from the creeper
Location
type usage:
See location at (expression)
type name patterns[?]:
location[s]
since:
1.0
A location in a world. Locations are world-specific and even store a direction, e.g. if you save a location and later teleport to it you will face the exact same direction you did when you saved the location.
In the case of the teleport effect you can set a location's yaw and pitch to 0 to prevent this behaviour.
Money
type usage:
<number> $ or $ <number>, where '$' is your server's currency, e.g. '10 rupees' or '£5.00'
type name patterns[?]:
cannot be used directly
since:
2.0
A certain amount of money. Please note that this differs from numbers as it includes a currency symbol or name, but usually the two are interchangeable, e.g. you can both add 100$ to the player's balance and add 100 to the player's balance.
Like all economy elements, this type requires that Vault and a compatible economy plugin is installed.
examples:
add 10£ to the player's account
remove Fr. 9.95 from the player's money
set the victim's money to 0
increase the attacker's balance by the level of the victim * 100
Number
type usage:
[-]###[.###] (any amount of digits; very large numbers will be truncated though)
type name patterns[?]:
num[ber][s]
since:
1.0
A number, e.g. 2.5, 3, or -9812454.
Please note that many expressions only need integers, i.e. will discard any frational parts of any numbers without producing an error.
examples:
set the player's health to 5.5
set {_temp} to 2*{_temp} - 2.5
Object
type usage:
cannot be written in scripts
type name patterns[?]:
cannot be used directly
since:
1.0
The supertype of all types, meaning that if %object% is used in e.g. a condition it will accept all kinds of expressions.
Offlineplayer
type usage:
cannot be written in scripts
type name patterns[?]:
offline[ ]player[s]
since:
unknown
A player that is possibly offline. See player for more information. Please note that while all effects and conditions that require a player can be used with an offline player as well, they will not work if the player is not actually online.
Player
type usage:
cannot be written in scripts
type name patterns[?]:
player[s]
since:
1.0
A player. Depending on whether a player is online or offline several actions can be performed with them, though you won't get any errors when using effects that only work if the player is online (e.g. changing his inventory) on an offline player.
You have two possibilities to use players as command arguments: <player> and <offline player>. The first requires that the player is online and also accepts only part of the name, while the latter doesn't require that the player is online, but the player's name has to be entered exactly.
Potion Effect Type
type usage:
speed, slowness, haste, mining fatigue, strength, instant health, instant damage, jump boost, nausea, regeneration, resistance, fire resistance, water breathing, invisibility, blindness, night vision, hunger, weakness, poison, wither
type name patterns[?]:
potion[[ ]effect][[ ]type][s]
since:
unknown
A potion effect, e.g. 'strength' or 'swiftness'.
examples:
apply swiftness 5 to the player
apply potion of speed 2 to the player for 60 seconds
remove invisibility from the victim
Projectile
type usage:
arrow, fireball, snowball, thrown potion, etc.
type name patterns[?]:
projectile[s]
since:
1.0
A projectile, e.g. an arrow, snowball or thrown potion.
examples:
projectile is a snowball
shoot an arrow at speed 5 from the player
Region
type usage:
"region name"
type name patterns[?]:
cannot be used directly
since:
2.1
A region of a regions plugin. Skript currently supports WorldGuard, Factions, GriefPrevention and PreciousStones.
Please note that some regions plugins do not have named regions, some use numerical ids to identify regions, and some may have regions with the same name in different worlds, thus using regions like "region name" in scripts may or may not work.
Text
type usage:
simple: "..."
quotes: "...""..."
expressions: "...%expression%..."
percent signs: "...%%..."
type name patterns[?]:
(text|string)[s]
since:
1.0
Text is simply text, i.e. a sequence of characters, which can optionally contain expressions which will be replaced with a meaningful representation (e.g. %player% will be replaced with the player's name).
Because scripts are also text, you have to put text into double quotes to tell Skript which part of the line is an effect/expression and which part is the text.
Please read the article on Texts and Variable Names to learn more.
examples:
broadcast "Hello World!"
message "Hello %player%"
message "The id of ""%type of tool%"" is %id of tool%."
Time
type usage:
- [:##][ ]am/pm
type name patterns[?]:
time[s]
since:
1.0
A time is a point in a minecraft day's time (i.e. ranges from 0:00 to 23:59), which can vary per world.
See date and timespan for the other time types of Skript.
examples:
at 20:00:
time is 8 pm
broadcast "It's %time%"
Timeperiod
type usage:
- - ##:##
dusk/day/dawn/night
type name patterns[?]:
time[ ]period[s]
duration[s]
since:
1.0
A period of time between two times. Mostly useful since you can use this to test for whether it's day, night, dusk or dawn in a specific world.
This type might be removed in the future as you can use 'time of world is between x and y' as a replacement.
examples:
time in world is night
Timespan
type usage:
<number> [minecraft/mc/real/rl/irl] ticks/seconds/minutes/hours/days [[,/and] <more...>]
[###:]##:##[.####] ([hours:]minutes:seconds[.milliseconds])
type name patterns[?]:
time[ ]span[s]
since:
1.0
A timespan is a difference of two different dates or times, e.g '10 minutes'. Timespans are always displayed as real life time, but can be defined as minecraft time, e.g. '5 minecraft days and 12 hours'.
See date and time for the other time types of Skript.
examples:
every 5 minecraft days:
wait a minecraft second and 5 ticks
every 10 mc days and 12 hours:
halt for 12.7 irl minutes, 12 hours and 120.5 seconds
Tree Type
type usage:
[any] <general tree/mushroom type>, e.g. tree/any jungle tree/etc.
<specific tree/mushroom species>, e.g. red mushroom/small jungle tree/big regular tree/etc.
type name patterns[?]:
tree[ ]type[s]
tree[s]
since:
unknown
A tree type represents a tree species or a huge mushroom species. These can be generated in a world with the generate tree effect.
examples:
grow any regular tree at the block
grow a huge red mushroom above the block
Type
type usage:
See the type name patterns of all types - including this one
type name patterns[?]:
type[s]
since:
2.0
Represents a type, e.g. number, object, item type, location, block, world, entity type, etc.
This is mostly used for expressions like 'event-<type>', '<type>-argument', 'loop-<type>', etc., e.g. event-world, number-argument and loop-player.
examples:
{variable} is a number # check whether the variable contains a number, e.g. -1 or 5.5
{variable} is a type # check whether the variable contains a type, e.g. number or player
{variable} is an object # will always succeed if the variable is set as everything is an object, even types.
disable PvP in the event-world
kill the loop-entity
Visual Effect
type usage:
ender signal, mobspawner flames, potion break, smoke, hurt, sheep eating, wolf hearts, wolf shaking, wolf smoke
type name patterns[?]:
(visual|particle) effect[s]
since:
2.1
A visible effect, e.g. particles.
examples:
show wolf hearts on the clicked wolf
play mob spawner flames at the targeted block to the player
Weather Type
type usage:
clear/sun/sunny, rain/rainy/raining, and thunder/thundering/thunderstorm
type name patterns[?]:
weather[ ]type[s]
weather condition[s]
weather[s]
since:
1.0
The weather types sunny, rainy, and thundering.
examples:
is raining
is sunny in the player's world
message "It is %weather in the argument's world% in %world of the argument%"
World
type usage:
"world_name", e.g. "world"
type name patterns[?]:
world[s]
since:
1.0
One of the server's worlds. Worlds can be put into scripts by surrounding their name with double quotes, e.g. "world_nether", but this might not work reliably as text uses the same syntax.
examples:
broadcast "Hello!" to "world_nether"
About ~ njol.ch created by Peter Güttinger ~ icons by Yusuke Kamiyamane ~
Last modified: Freyja's Day, 9th August 2013, 09:43
text
Njol.ch
»
Projects
»
Skript
Yggdrasil
Markup
»
Documentation
Tutorial
API
Statistics
» Skript: Text & Variable NamesEventsConditionsEffectsExpressionsLoopsCustom CommandsTypesTextVariables
Using text in scripts can be really simple, e.g. to send ‘Hello!’ to some player you can use send "Hello!" to player. As you can see you have to put double quotes around whatever text you want to use (to include a double quote you'll have to double it: "What's this ""thing"" you're talking about?"). Often you'll want to include e.g. the player's name in a text which can be done by inserting %player% where you want the player's name to appear, e.g. send "Hello %player%!" to player would send ‘Hello Njol!’ to me. You can put all expressions between such percent signs, e.g. message "The block above the block you're looking at is a %block above targeted block%". Similar to quotes you have to double the percent sign if you want to use one in a text: "100%%!".
Chat Colours and Styles
Colours and chat styles can be included in messages in two different ways: Either with the common ‘&x’/‘§x’ colour codes or by using Skript's <colour> codes, e.g. broadcast "<red><bold>Important Information:<reset> <blue>This server needs more mods!". You can also use the colour of an item in a message, e.g. message "<%colour of tool%>this text is coloured depending on the player's held item!".
The default english colours and chat styles are:
colours: black, dark grey/dark gray, grey/light grey/gray/light gray/silver, white, blue/dark blue, cyan/aqua/dark cyan/dark aqua, light blue/light cyan/light aqua, green/dark green, light green/lime/lime green, yellow/light yellow, orange/gold/dark yellow, red/dark red, pink/light red, purple/dark purple, magenta/light purple, brown/indigo
chat styles: bold/b, italics/italic/i, strikethrough/strike/s, underlined/underline/u, magic, reset/r
Other languages may use other colours, but those are only used rarely, e.g. by the colour expression (useful to colour command arguments), as scripts always use the english colour codes.
Advanced Syntax
Skript version 2.0 and above can handle nouns more advanced than by simply inserting them into the text:
"a %expression" or "an %expression" will add the appropriate indefinite article to the expression, e.g. “a fish”, “an apple”, or “a pickaxe and an emerald”. The same applies to the definite article ‘the’ ("the %expression%"), though this is barely noticeable in the english language, only some nouns like ‘air’ will completely remove the article in this case. Please note that for other languages you'll have to use that language's articles, e.g. "der %expression" or "ein %expression%" in german.
"%expression%s" as well as "<number> %expression%" (for numbers other than 1) causes the expression to be displayed as plural, e.g. "2 %block%" can result in “2 logs” (the number can also be another expression, e.g. "%number-argument% %item-argument%" could turn into “5 pickaxes” or “1 pickaxe”). Unlike articles this syntax is the same for all languages.
Variable Names
Variable names are very similar to text, except that you have to enclose them in curly brackets instead of double quotes: {variable}. Expressions also do not use the advanced syntax described above as that's useless in a variable's name.
About ~ njol.ch created by Peter Güttinger ~ icons by Yusuke Kamiyamane ~
Last modified: Freyja's Day, 17th January 2014, 22:39
Var
Njol.ch
»
Projects
»
Skript
Yggdrasil
Markup
»
Documentation
Tutorial
API
Statistics
» Skript: VariablesEventsConditionsEffectsExpressionsLoopsCustom CommandsTypesTextVariables
Variables are Skript's way to save data. Every variable has a name and a value, i.e. some stored data. You can put variables anywhere in your triggers to replace something, e.g. you can replace a location with a variable that holds a location.
This can for example be used for a /home command: make a variable ‘home’ and a command /home which teleports the player to the location stored in the ‘home’ variable.
To distinguish variables from the rest of the trigger their name has to be put in curly brackets like this: {variable name}. A variable's name can also contain expressions, e.g. to make a ‘home’ variable for every player you can make a variable like {home.%player%} where %player% will be replaced by the player's name every time the variable is used, which essentially creates a ‘home’ variable that is different for every player.
All variables are saved in a file called ‘variables.csv’ in the plugin's folder. Please do not edit the file manually, if you do something wrong you might wipe out some variables. The variables are written to this file constantly, so a server crash will make you loose at most one variable. Starting with version 2.0 you can also choose to save variables in a database which can also be monitored for changes, e.g. if you have multiple servers and want to synchronize variables between them.
There are 3 different kinds of variables: ‘normal’ variables, local variables and options. Normal variables (usually simply called variables) are unique, i.e. there can only exist one variable with the same name, and they are saved between server restarts.
Local variables (which are identified with an underscore: {_local variable}) are ‘local to the event’, which means that there can exist several of these variables with the same name simultaneously, e.g. the following trigger will send a player his name one minute after he joined:
on join:
set {_player} to player
wait a minute
message "%{_player}%" # the local variable is unchanged no matter how many players joined in the meantime
If a normal variable was used all players would recieve the name of the last player who joined since normal variables are unique.
Local variables are also automatically deleted when they are not needed anymore and do not clutter the variables file, but their data is lost when the server stops (which does not matter that much as all scripts also stop running and won't resume where they left off when the server restarts).
The last kind of variables are options which are not actually variables at all. You can add a section ‘options’ to your script like this:
options:
option name = option value
You can then use these options anywhere in your scripts with {@option name}. The reason why I stress anywhere is because options will be replaced one-to-one with their values just before the script is parsed. Thus you can put anything into options, even whole script lines or parts thereof. Remember to not use percent signs around options in text though as the percent signs will remain.
List Variables
List variables are variables which can hold multiple values. They look like {variable name::*} and can have elements added and removed from them using the default add and remove effects, can be deleted which will clear all values of the list, and overwritten with new values with the set effect. You can access a specific value of a list variable with {variable name::index} where ‘index’ is the index of the value you want. The index can be anything, e.g. a player name or a number, but when adding values to the list with the add effect the index of the new value will be a number.
List variables can be looped with loop {list variable::*}. Within the loop the currently looped value can be accessed with loop-value and its index with loop-index.
List variables are also useful to show a list in a message, e.g. a list of all admins online, by first adding them to the same list variable and then using that variable in the message (see the last example below). Using a local list variable for this purpose is recommended: {_local list variable::*}
Examples
As I'm not very good at explaining the rest of this page is filled with some examples:
Save how many players have ever logged into your server:
- if you add a 'variables:' section to your script, the variables defined there will be set to the given value if they don't exist
- when the script is loaded. You cannot change an existing variable's value this way however, in particular if you
- change the variables' values here the actual variables will not be changed at all.
variables:
{logincount} = 0
on login:
add 1 to {logincount}
command /logincount:
description: Find out how many people have ever logged into this server
trigger:
message "Since its beginnings <green>%{logincount}%<reset> people have logged into this server"
A simple /home plugin:
command /sethome:
permission: skript.home
description: Set your home
trigger:
set {home.%player%} to location of player
message "Set your home to <grey>%location of player%<reset>"
command /home:
permission: skript.home
description: Teleport yourself to your home
trigger:
if {home.%player%} is not set:
message "You have not set your home yet!"
stop trigger
teleport player to {home.%player%}
A command that shows the currently online staff:
command /staff:
description: Shows online staff
trigger:
loop all players:
loop-player has permission "is.staff"
add loop-player to {_online staff::*}
size of {_online staff::*} is 0:
message "No staff currently online! Happy griefing ;)!"
else:
message "Online staff: %{_online staff::*}%"
About ~ njol.ch created by Peter Güttinger ~ icons by Yusuke Kamiyamane ~
Last modified: Freyja's Day, 17th January 2014, 22:50