Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update old scripts examples #2559

Merged
merged 13 commits into from
Mar 7, 2020
24 changes: 0 additions & 24 deletions src/main/resources/scripts/block head.sk

This file was deleted.

81 changes: 38 additions & 43 deletions src/main/resources/scripts/furnace automatisation.sk
Original file line number Diff line number Diff line change
@@ -1,43 +1,38 @@
#
# This file automates furnaces.
# They store smelted items, refuel and restock automatically in/from surrounding chests
# But only as long as they have fuel and something to smelt, and there's storage space for the smolten item(s).,
# I.e. if a furnace stops burning it won't resume automatically, but has to be lit manually again.
#

options:
# radius: in which radius chest should be searched.
# Putting a small radius is recommended as it increases performance and prevents furnaces from taking items out of chests behind walls or otherwise hidden chests.
# Some recommended values:
# 1: only chests direcly next to the furnace are affected
# 1.5: chests diaginally adjacent (i.e. which touch the furnace with one edge) are affected as well
# 1.75: all surrounding chests in a 3x3x3 cube are affected
radius: 1

on fuel burn:
fuel slot of block will be empty
loop blocks in radius {@radius}:
loop-block is chest
loop items of type fuel:
loop-block contains loop-item
remove loop-item from loop-block
set fuel of event-block to loop-item
stop trigger

on smelt:
ore slot of block will be empty
loop blocks in radius {@radius}:
loop-block is chest
loop items of types ore and log:
loop-block contains loop-item
remove loop-item from loop-block
set ore of event-block to loop-item
stop trigger

on smelt:
loop blocks in radius {@radius}:
loop-block is chest
loop-block can hold result of event-block
add result of event-block to loop-block
clear result of event-block
stop trigger
Olyno marked this conversation as resolved.
Show resolved Hide resolved
#
# This file automates furnaces.
Olyno marked this conversation as resolved.
Show resolved Hide resolved
# They store smelted items, refuel and restock automatically in/from surrounding chests
Olyno marked this conversation as resolved.
Show resolved Hide resolved
# But only as long as they have fuel and something to smelt, and there's storage space for the smolten item(s).,
Olyno marked this conversation as resolved.
Show resolved Hide resolved
# I.e. if a furnace stops burning it won't resume automatically, but has to be lit manually again.
#

options:
# radius: in which radius chest should be searched.
# Putting a small radius is recommended as it increases performance and prevents furnaces from taking items out of chests behind walls or otherwise hidden chests.
# Some recommended values:
# 1: only chests direcly next to the furnace are affected
# 1.5: chests diaginally adjacent (i.e. which touch the furnace with one edge) are affected as well
# 1.75: all surrounding chests in a 3x3x3 cube are affected
radius: 1

aliases:
fuel = coal, coal ore, coal block, any wooden tool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any wood log? Lava bucket? Also I'm quite sure coal ore shouldn't be a fuel source


on smelt:
loop blocks in radius {@radius}:
loop-block is chest
Olyno marked this conversation as resolved.
Show resolved Hide resolved
if ore slot of block is empty:
loop items of types ore and log:
inventory of loop-block contains loop-item
remove loop-item from inventory of loop-block
set ore of event-block to loop-item
exit loop
if fuel slot of block is empty:
loop items in inventory of loop-block:
loop-item is fuel
remove 1 of loop-item from inventory of loop-block
set fuel of event-block to 1 of loop-item
exit loop
if result slot of block is not empty:
loop-block can hold result of event-block
add result of event-block to loop-block
clear result of event-block
26 changes: 17 additions & 9 deletions src/main/resources/scripts/homes.sk
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
#
# A simple home script which allows players with the permission 'skript.home' to
# define a home location with /sethome and teleport to that location whenever they want to with /home.
# define a home location with /sethome, delete home with /delhome and teleport to that location whenever they want to with /home.
Olyno marked this conversation as resolved.
Show resolved Hide resolved
#

command /sethome:
command /sethome <string>:
description: Set your home
Olyno marked this conversation as resolved.
Show resolved Hide resolved
permission: skript.home
executable by: players
trigger:
set {homes.%player%.location} to location of player
message "Set your home to <grey>%location of player%<reset>"
set {homes::%uuid of player%::%arg-1%} to location of player
message "Set your home <green>%arg-1%<reset> to <grey>%location of player%<reset>"

command /home:
command /delhome <string>:
description: Delete your home
Olyno marked this conversation as resolved.
Show resolved Hide resolved
permission: skript.home
executable by: players
trigger:
clear {homes::%uuid of player%::%arg-1%}
message "Delete your home <green>%arg-1%<reset>"
Olyno marked this conversation as resolved.
Show resolved Hide resolved

command /home <string>:
description: Teleport yourself to your home
permission: skript.home
executable by: players
trigger:
if {homes.%player%.location} is not set:
message "You have not set your home yet!"
stop trigger
teleport player to {homes.%player%.location}
if {homes::%uuid of player%::%arg-1%} is not set:
message "You have not set your home <green>%arg-1%<reset> yet!"
else:
teleport player to {homes::%uuid of player%::%arg-1%}
12 changes: 6 additions & 6 deletions src/main/resources/scripts/item command.sk
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ command /item <items>:
executable by: players
permission: skript.give
trigger:
player has permission "skript.give.bypassblacklist":
if player has permission "skript.give.bypassblacklist":
give arguments to player
else:
loop arguments:
loop-item is not blacklisted:
if loop-item is not blacklisted:
Olyno marked this conversation as resolved.
Show resolved Hide resolved
give loop-item to player
else:
message "<red>%loop-item%<reset> is blacklisted and thus cannot be spawned"
Expand All @@ -39,11 +39,11 @@ command /item2 <items>:
permission: skript.give
trigger:
loop arguments:
loop-item is enchanted:
player does not have the permission "skript.give.enchanted":
if loop-item is enchanted:
if player does not have the permission "skript.give.enchanted":
message "You don't have permission to spawn enchanted items!"
stop
player has permission "skript.give.%ID of loop-item%":
if player has permission "skript.give.%ID of loop-item%":
give loop-item to player
else:
message "You don't have permission to spawn <red>%loop-item%<reset>!"
Expand All @@ -56,7 +56,7 @@ command /give <item types> to <player>:
trigger:
send "Giving %argument 1% to %argument 2%" to player
loop argument 1:
player has permission "skript.give.%ID of loop-item%":
if player has permission "skript.give.%ID of loop-item%":
give loop-item to argument 2
send "You recieved %loop-item% from %player%" to argument 2
else:
Expand Down
20 changes: 10 additions & 10 deletions src/main/resources/scripts/kill counter.sk
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@
# Defaults are useful here, as a player's kills would be '<none>' if he hasn't killed anything yet,
# but with defaults defined those will be used in that case.
variables:
{kill counter.%player%.kills_session} = 0
{kill counter.%player%.kills_session_max} = 0
{kill counter.%player%.kills_total} = 0
{kill counter::%player%::kills_session} = 0
Olyno marked this conversation as resolved.
Show resolved Hide resolved
{kill counter::%player%::kills_session_max} = 0
{kill counter::%player%::kills_total} = 0

on death:
attacker is a player
add 1 to {kill counter.%attacker%.kills_total}
add 1 to {kill counter.%attacker%.kills_session}
{kill counter.%attacker%.kills_session} is greater than {kill counter.%attacker%.kills_session_max}:
set {kill counter.%attacker%.kills_session_max} to {kill counter.%attacker%.kills_session}
add 1 to {kill counter::%attacker%::kills_total}
add 1 to {kill counter::%attacker%::kills_session}
if {kill counter::%attacker%::kills_session} > {kill counter::%attacker%::kills_session_max}:
set {kill counter::%attacker%::kills_session_max} to {kill counter::%attacker%::kills_session}

on death of player:
set {kill counter.%player%.kills_session} to 0
set {kill counter::%player%::kills_session} to 0

command /kills:
executable by: players
trigger:
message "You have killed %{kill counter.%player%.kills_session}% mobs and players in this life out of %{kill counter.%player%.kills_total}% kills in total."
message "Your maximum kill streak is %{kill counter.%player%.kills_session_max}% kills in one life."
message "You have killed %{kill counter::%player%::kills_session}% mobs and players in this life out of %{kill counter::%player%::kills_total}% kills in total."
message "Your maximum kill streak is %{kill counter::%player%::kills_session_max}% kills in one life."
3 changes: 2 additions & 1 deletion src/main/resources/scripts/nerf endermen.sk
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

on enderman pickup:
cancel event

on enderman place:
cancel event
kill the enderman # kills endermen which were still carrying something when this trigger file was activated
kill the enderman # kills endermen which were still carrying something when this trigger file was activated
32 changes: 0 additions & 32 deletions src/main/resources/scripts/plant with hoe.sk

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#
# these triggers fix some drops.
#
on break of glass:
drop glass
on break of glass pane:
drop glass pane
on break of bookshelf:
cancel event
set block to air
drop bookshelf
#
# these triggers fix some drops.
Olyno marked this conversation as resolved.
Show resolved Hide resolved
#

on break of glass:
drop glass

on break of glass pane:
drop glass pane

on break of bookshelf:
cancel event
set block to air
drop bookshelf
Olyno marked this conversation as resolved.
Show resolved Hide resolved
27 changes: 27 additions & 0 deletions src/main/resources/scripts/simple join and leave message.sk
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#
# A join and leave message.
#

command /set <string> message <string>:
permission: skript.set.join message
Olyno marked this conversation as resolved.
Show resolved Hide resolved
description: Sets message when player joins
trigger:
if argument-1 is "join" or "leave":
set {custom messages::%argument-1%} to argument-2
message "Set the %argument-1% message to '%argument-2%<reset>'"
else:
message "Only 'join' and 'leave' messages are available here."

command /show <string> message:
description: Displays the message of the day
trigger:
if {custom messages::%argument%} is set:
message {custom messages::%argument%}
else:
message "Only 'join' and 'leave' messages are available here."

on join:
set join message to {custom messages::join}

on quit:
set leave message to {custom messages::leave}
46 changes: 23 additions & 23 deletions src/main/resources/scripts/simple motd.sk
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#
# A simple message of the day script.
# The MOTD can be set with the /setmotd command,
# and it will be sent to each player when they log in
# and when they use the /motd command.
#
command /setmotd <text>:
permission: skript.setmotd
description: Sets message of the day
trigger:
message "Set the MOTD to '%argument%<reset>'"
set {motd} to argument
command /showmotd:
description: Displays the message of the day
trigger:
message {motd}
on join:
# uncomment the following line to make the MOTD appear after other messages
# wait a tick
message {motd}
Olyno marked this conversation as resolved.
Show resolved Hide resolved
#
# A simple message of the day script.
# The MOTD can be set with the /setmotd command,
# and it will be sent to each player when they log in
# and when they use the /motd command.
#

command /setmotd <text>:
permission: skript.setmotd
description: Sets message of the day
Olyno marked this conversation as resolved.
Show resolved Hide resolved
trigger:
message "Set the MOTD to '%argument%<reset>'"
set {motd} to argument

command /showmotd:
description: Displays the message of the day
trigger:
message {motd}

on join:
# uncomment the following line to make the MOTD appear after other messages
# wait a tick
message {motd}
6 changes: 0 additions & 6 deletions src/main/resources/scripts/teleport with compass.sk
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,8 @@
# with a compass like in WorldEdit.
#

aliases:
# blocks without collision as of Minecraft 1.5 (excluding fire, nether portal & end portal)
nonsolid = 0, 6, 27, 28, 30, 31, 32, 37, 38, 39, 40, 50, 55, 59, 63, 64, 65, 66, 68, 69, 70, 71, 72, 75, 76, 77, 78:0, 83, 85:4-7, 104, 105, 106, 111, 115, 131, 132, 141, 142, 143, 147, 148, 157

on rightclick with compass:
player has permission "skript.teleport"
Olyno marked this conversation as resolved.
Show resolved Hide resolved
loop blocks above targeted block:
loop-block is nonsolid
block above loop-block is nonsolid
teleport player to loop-block
stop trigger
Loading