Patterns: |
|
Since: | 2.5 |
Return Type: | Text |
Returns all of the scripts, or just the enabled or disabled ones.
Examples:
command /scripts:
trigger:
send "All Scripts: %scripts%" to player
send "Loaded Scripts: %enabled scripts%" to player
send "Unloaded Scripts: %disabled scripts%" to player
trigger:
send "All Scripts: %scripts%" to player
send "Loaded Scripts: %enabled scripts%" to player
send "Unloaded Scripts: %disabled scripts%" to player
Patterns: |
|
Since: | 2.2-dev16 (lowercase and uppercase), 2.5 (advanced cases) |
Return Type: | Text |
Copy of given text in Lowercase, Uppercase, Proper Case, camelCase, PascalCase, Snake_Case, and Kebab-Case
Examples:
"Oops!" in lowercase # oops!
"oops!" in uppercase # OOPS!
"hellO i'm steve!" in proper case # HellO I'm Steve!
"hellO i'm steve!" in strict proper case # Hello I'm Steve!
"spAwn neW boSs ()" in camel case # spAwnNeWBoSs()
"spAwn neW boSs ()" in strict camel case # spawnNewBoss()
"geneRate ranDom numBer ()" in pascal case # GeneRateRanDomNumBer()
"geneRate ranDom numBer ()" in strict pascal case # GenerateRandomNumber()
"Hello Player!" in snake case # Hello_Player!
"Hello Player!" in lower snake case # hello_player!
"Hello Player!" in upper snake case # HELLO_PLAYER!
"What is your name?" in kebab case # What-is-your-name?
"What is your name?" in lower kebab case # what-is-your-name?
"What is your name?" in upper kebab case # WHAT-IS-YOUR-NAME?
"oops!" in uppercase # OOPS!
"hellO i'm steve!" in proper case # HellO I'm Steve!
"hellO i'm steve!" in strict proper case # Hello I'm Steve!
"spAwn neW boSs ()" in camel case # spAwnNeWBoSs()
"spAwn neW boSs ()" in strict camel case # spawnNewBoss()
"geneRate ranDom numBer ()" in pascal case # GeneRateRanDomNumBer()
"geneRate ranDom numBer ()" in strict pascal case # GenerateRandomNumber()
"Hello Player!" in snake case # Hello_Player!
"Hello Player!" in lower snake case # hello_player!
"Hello Player!" in upper snake case # HELLO_PLAYER!
"What is your name?" in kebab case # What-is-your-name?
"What is your name?" in lower kebab case # what-is-your-name?
"What is your name?" in upper kebab case # WHAT-IS-YOUR-NAME?
Patterns: | |
Since: | 2.8.0 |
Return Type: | Text |
All characters between two given characters, useful for generating random strings. This expression uses the Unicode numerical code of a character to determine which characters are between the two given characters. The ASCII table linked here shows this ordering for the first 256 characters. If you would like only alphanumeric characters you can use the 'alphanumeric' option in the expression. If strings of more than one character are given, only the first character of each is used.
Examples:
loop characters from "a" to "f":
broadcast "%loop-value%"
# 0123456789:;<=>?@ABC... ...uvwxyz
send characters between "0" and "z"
# 0123456789ABC... ...uvwxyz
send alphanumeric characters between "0" and "z"
broadcast "%loop-value%"
# 0123456789:;<=>?@ABC... ...uvwxyz
send characters between "0" and "z"
# 0123456789ABC... ...uvwxyz
send alphanumeric characters between "0" and "z"
Patterns: | |
Since: | 2.0 |
Return Type: | Text |
Parses <color>s and, optionally, chat styles in a message or removes any colors and chat styles from the message. Parsing all chat styles requires this expression to be used in same line with the send effect.
Examples:
on chat:
set message to colored message # Safe; only colors get parsed
command /fade <player>:
trigger:
set display name of the player-argument to uncolored display name of the player-argument
command /format <text>:
trigger:
message formatted text-argument # Safe, because we're sending to whoever used this command
set message to colored message # Safe; only colors get parsed
command /fade <player>:
trigger:
set display name of the player-argument to uncolored display name of the player-argument
command /format <text>:
trigger:
message formatted text-argument # Safe, because we're sending to whoever used this command
Patterns: | |
Since: | 2.2-dev33 |
Return Type: | Date |
A date the specified timespan before/after another date.
Examples:
set {_yesterday} to 1 day ago
set {_hourAfter} to 1 hour after {someOtherDate}
set {_hoursBefore} to 5 hours before {someOtherDate}
set {_hourAfter} to 1 hour after {someOtherDate}
set {_hoursBefore} to 5 hours before {someOtherDate}
Patterns: |
|
Since: | 2.0, 2.2-dev32 (SHA-256 algorithm) |
Return Type: | Text |
Hashes the given text using the MD5 or SHA-256 algorithms. Each algorithm is suitable for different use cases.
MD5 is provided mostly for backwards compatibility, as it is outdated and not secure. SHA-256 is more secure, and can used to hash somewhat confidental data like IP addresses and even passwords. It is not that secure out of the box, so please consider using salt when dealing with passwords! When hashing data, you must specify algorithms that will be used for security reasons!
Please note that a hash cannot be reversed under normal circumstanses. You will not be able to get original value from a hash with Skript.
Examples:
command /setpass <text>:
trigger:
set {password::%uuid of player%} to text-argument hashed with SHA-256
command /login <text>:
trigger:
if text-argument hashed with SHA-256 is {password::%uuid of player%}:
message "Login successful."
else:
message "Wrong password!"
trigger:
set {password::%uuid of player%} to text-argument hashed with SHA-256
command /login <text>:
trigger:
if text-argument hashed with SHA-256 is {password::%uuid of player%}:
message "Login successful."
else:
message "Wrong password!"
Patterns: | |
Since: | 2.1 |
Return Type: | long |
The first or 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 {_first} 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}
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}
Patterns: | |
Since: | 2.4 (indices), 2.6.1 (sorting) |
Return Type: | Text |
Returns all the indices of a list variable, optionally sorted by their values. To sort the indices, all objects in the list must be comparable; Otherwise, this expression will just return the unsorted indices.
Examples:
set {l::*} to "some", "cool" and "values"
broadcast "%indices of {l::*}%" # result is 1, 2 and 3
set {_leader-board::first} to 17
set {_leader-board::third} to 30
set {_leader-board::second} to 25
set {_leader-board::fourth} to 42
set {_ascending-indices::*} to sorted indices of {_leader-board::*} in ascending order
broadcast "%{_ascending-indices::*}%" #result is first, second, third, fourth
set {_descending-indices::*} to sorted indices of {_leader-board::*} in descending order
broadcast "%{_descending-indices::*}%" #result is fourth, third, second, first
broadcast "%indices of {l::*}%" # result is 1, 2 and 3
set {_leader-board::first} to 17
set {_leader-board::third} to 30
set {_leader-board::second} to 25
set {_leader-board::fourth} to 42
set {_ascending-indices::*} to sorted indices of {_leader-board::*} in ascending order
broadcast "%{_ascending-indices::*}%" #result is first, second, third, fourth
set {_descending-indices::*} to sorted indices of {_leader-board::*} in descending order
broadcast "%{_descending-indices::*}%" #result is fourth, third, second, first
Patterns: |
|
Since: | 2.7 |
Return Type: | Text |
An expression to obtain a list of the names of the server's loaded plugins.
Examples:
if the loaded plugins contains "Vault":
broadcast "This server uses Vault plugin!"
send "Plugins (%size of loaded plugins%): %plugins%" to player
broadcast "This server uses Vault plugin!"
send "Plugins (%size of loaded plugins%): %plugins%" to player
Patterns: |
|
Since: | 2.8.0 |
Return Type: | long |
Returns the loop's current iteration count (for both normal and while loops).
Examples:
while player is online:
give player 1 stone
wait 5 ticks
if loop-counter > 30:
stop loop
loop {top-balances::*}:
if loop-iteration <= 10:
broadcast "##%loop-iteration% %loop-index% has $%loop-value%"
give player 1 stone
wait 5 ticks
if loop-counter > 30:
stop loop
loop {top-balances::*}:
if loop-iteration <= 10:
broadcast "##%loop-iteration% %loop-index% has $%loop-value%"
Patterns: |
|
Since: | 1.0, 2.8.0 (loop-counter) |
Return Type: | Object |
Returns the currently looped value.
Examples:
# Countdown
loop 10 times:
message "%11 - loop-number%"
wait a second
# Generate a 10x10 floor made of randomly colored 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
loop {top-balances::*}:
loop-iteration <= 10
send "##%loop-iteration% %loop-index% has $%loop-value%"
loop 10 times:
message "%11 - loop-number%"
wait a second
# Generate a 10x10 floor made of randomly colored 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
loop {top-balances::*}:
loop-iteration <= 10
send "##%loop-iteration% %loop-index% has $%loop-value%"
Patterns: |
|
Since: | 1.4 |
Return Type: | Date |
Examples:
broadcast "Current server time: %now%"
Patterns: | |
Since: | 2.5 |
Return Type: | long |
The number of uppercase, lowercase, or digit characters in a string.
Examples:
#Simple Chat Filter
on chat:
if number of uppercase chars in message / length of message > 0.5
cancel event
send "<red>Your message has to many caps!" to player
on chat:
if number of uppercase chars in message / length of message > 0.5
cancel event
send "<red>Your message has to many caps!" to player
Patterns: | |
Since: | 1.4.6 (integers & numbers), 2.5.1 (decimals) |
Return Type: | Number |
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. You may also use 'decimals' if you want to use the decimal precision of the start number. You may want to use the 'times' expression instead, for instance 'loop 5 times:'
Examples:
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
loop decimals from 3.94 to 4: # loops 3.94, 3.95, 3.96, 3.97, 3.98, 3.99, 4
loop integers from 2.9 to 5.1: # same as '3 to 5', i.e. loops 3, 4, 5
loop decimals from 3.94 to 4: # loops 3.94, 3.95, 3.96, 3.97, 3.98, 3.99, 4
Patterns: | |
Since: | 2.0 |
Return Type: | Object |
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
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
Patterns: |
|
Since: | 2.0 |
Return Type: | Text |
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!"
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!"
Patterns: | |
Since: | 2.8.0 |
Return Type: | Number |
Returns a percentage of one or more numbers.
Examples:
set damage to 10% of victim's health
set damage to 125 percent of damage
set {_result} to {_percent} percent of 999
set {_result::*} to 10% of {_numbers::*}
set experience to 50% of player's total experience
set damage to 125 percent of damage
set {_result} to {_percent} percent of 999
set {_result::*} to 10% of {_numbers::*}
set experience to 50% of player's total experience
Patterns: | |
Since: | 2.8.0 |
Return Type: | Text |
One or more random characters between two given characters. Use 'alphanumeric' if you want only alphanumeric characters. This expression uses the Unicode numerical code of a character to determine which characters are between the two given characters. If strings of more than one character are given, only the first character of each is used.
Examples:
set {_captcha} to join (5 random characters between "a" and "z") with ""
send 3 random alphanumeric characters between "0" and "z"
send 3 random alphanumeric characters between "0" and "z"
Patterns: | |
Since: | 1.4 |
Return Type: | Number |
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
send "You rolled a %random integer from 1 to 6%!" to the player
Patterns: |
|
Since: | 2.5.1 |
Return Type: | Text |
Returns a random UUID.
Examples:
set {_uuid} to random uuid
Patterns: | |
Since: | 2.0 |
Return Type: | long |
Rounds numbers normally, up (ceiling) or down (floor) respectively.
Examples:
set {var} to rounded health of player
set line 1 of the block to rounded "%(1.5 * player's level)%"
add rounded down argument to the player's health
set line 1 of the block to rounded "%(1.5 * player's level)%"
add rounded down argument to the player's health
Patterns: |
|
Since: | 2.0 |
Usable in events: | Script Load/Unload |
Return Type: | Text |
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
set {running::%script%} to true
on script unload:
set {running::%script%} to false
Patterns: |
|
Since: | 2.1, 2.5.2 (character at, multiple strings support) |
Return Type: | Text |
Extracts part of a text. You can either get the first <x> characters, the last <x> characters, the character at index <x>, 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
set {_characters::*} to characters at 1, 2 and 7 in player's display name
send the last character of all players' names
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
set {_characters::*} to characters at 1, 2 and 7 in player's display name
send the last character of all players' names
Patterns: | |
Since: | 2.7 |
Return Type: | Object |
Gets the value within objects. Usually used with variables to get the value they store rather than the variable itself, or with lists to get the values of a type.
Examples:
set {_entity} to a random entity out of all entities
delete entity within {_entity} # This deletes the entity itself and not the value stored in the variable
set {_list::*} to "something", 10, "test" and a zombie
broadcast the strings within {_list::*} # "something", "test"
delete entity within {_entity} # This deletes the entity itself and not the value stored in the variable
set {_list::*} to "something", 10, "test" and a zombie
broadcast the strings within {_list::*} # "something", "test"