command /appleexample: permission: skript.example.apple trigger: send "Giving you an apple!" set {_item} to give_apple("Banana", 4) give player {_item}function give_apple(name: text, amount: number) :: item: set {_item} to an apple set the name of {_item} to {_name} set the item amount of {_item} to {_amount} return {_item}
player's locationlocation of event-blocklocation at 0, 64, 0 in world "world"spawn of world "world"# Relative locationslocation 5 meters above playerlocation 10 blocks in front of player
loop all players: loop-player # The current player in the loop loop-index # The position in the loop (1, 2, 3...) if loop-player has permission "skript.example.apple": give loop-player an apple named "Potato"loop {_items::*}: loop-value # The current value loop-index # The position send "%loop-index%. %loop-value%"
now # Current date and time5 seconds10 minutes1 hour2 days# Time calculationsnow + 1 daytime since {timer}if {timer} is set: send "This command was last run %time since {timer}% ago."set {timer} to now
command /home <text> [<text>]: trigger: arg-1 # First argument (required) arg-2 # Second argument (optional) if arg-1 is "set": if arg-2 is set: set {homes::%uuid of player%::%arg-2%} to player's location
Arguments are numbered starting at 1. arg-1 is the first argument, arg-2 is the second, etc.
set {_result} to 10 + 5 # 15set {_result} to 20 - 8 # 12set {_result} to 4 * 6 # 24set {_result} to 15 / 3 # 5add 5 to {_number}remove 3 from {_number}set {_random} to a random integer between 1 and 100set {_random} to a random number between 0 and 2
Here’s a real example from the Skript source showing expression usage:
## This example stores a time-stamp in the global `{timer}` variable.# This variable is accessible everywhere, and will be saved when the server stops.## The `{_difference}` variable is local and is different for each use of the command.#command /timer: permission: skript.example.timer trigger: if {timer} is set: send "This command was last run %time since {timer}% ago." else: send "This command has never been run." set {timer} to now
# Store in variablesset {_value} to player's healthset {homes::%uuid of player%::home} to player's location# Use in conditionsif player's health is less than 5:if {_list::*} contains "apple":
Expressions can be combined and nested. For example: name of helmet of player gets the name of the item in the player’s helmet slot.