Simple Expressions
A list and short description of all simple expressions in the default language specification.
This page contains a list of the simple expressions in the skript language specification. Complex or unusual expressions have their own dedicated pages.
Syntax provided by external libraries is not documented here.
Comparisons
Contains
%Object% contains %Object%
Check whether the first object contains the second. Applies to strings, lists and collection types.
Returns a boolean value.
Exists
%Object% (exists|is set)
Check whether the value exists (is not null
.)
Returns a boolean value.
Greater Than
%Number% (is greater than|>) %Number%
Check whether the first number is greater than the second.
Returns a boolean value.
Greater Than or Equal To
%Number% (is greater than or equal to|>=) %Number%
Check whether the first number is greater than or equal to the second.
Returns a boolean value.
Less Than
%Number% (is less than|<) %Number%
Check whether the first number is less than the second.
Returns a boolean value.
Less Than or Equal To
%Number% (is less than or equal to|<=) %Number%
Check whether the first number is less than or equal to the second.
Returns a boolean value.
Is Array
%Object% (is|are) an array
Check whether the value is an array. This is separate from the of type
syntax because the internal name for array is objects
.
Returns a boolean value.
Is of Type
%Object% (is|are) a[n] %Type%
Check whether the value is of the given type.
Returns a boolean value.
Equals
%Object% (is|is equal to|=|==) %Object%
Check whether the two values are equal. This uses the superficial equals check and is safe to compare strings and numbers with. For a strict reference equivalent check, use the strict equals function.
Returns a boolean value.
Not Equal
%Object% (isn't|aren't|is not|are not|≠|!=) %Object%
Check whether the two values are not equal. This uses the superficial equals check and is safe to compare strings and numbers with. For a strict reference equivalent check, use the strict equals function.
Returns a boolean value.
Event Details
Current Event
[the] [current] event
The current event, if this process was started by an event call. This is usable anywhere within the program, but will return null
if the process was not started by an event trigger.
This can be used to retrieve event-specific values.
Returns an event.
Execution
Result of Executable
[the] result of %Executable%
Retrieves the result of an executable, such as a supplier lambda or a dynamic function. This will run the executable and provide its object value.
If used on a runnable lambda or a no-return function, the value will be null
.
Returns an object.
Runnable
[a] new runnable
See here for details on using this syntax.
Supplier
[a] new supplier
See here for details on using this syntax.
Function Call
function_name(args...)
See here for details on using this syntax.
External Function Call
function_name(args...) from skript/file
See here for details on using this syntax.
Dynamic Function Handle
[the] function %String%
See here for details on using this syntax.
Helper
These helper expressions provide clarity but no actual execution side-effects.
Brackets
(%Object%)
Used for assuring the inner expression is evaluated first when the order of operations is unclear. This is especially useful in maths expressions, since ByteSkript takes order of compilation over order of operations (and does not obey BIDMAS.)
Be careful not to confuse this with the implicit array creator (a, b, c)!
Returns whatever is inside.
Generic
A set of miscellaneous expressions providing useful values.
Current Script
[the] [current] script
Provides the qualified path name of the current script in the format skript/path/name
. This is the format used by the dynamic function expression.
Returns a string.
Java Version
[the] java version
Provides the java version number that this script was compiled with. Note: the JVM may be running a higher java version.
Returns a number.
New Line
(new[ ]line|nl)
Returns the line break for the current system ( or \r
etc.)
Returns a string.
System Input
[the] (system|console) input
Reads the next line from the command-line console as a string. Useful for requesting input for the user in command-line applications, but may be useless for non-command-line applications.
This is a blocking effect.
The script will wait until an input is provided by the user.
Returns a string.
System Property
[the] system property %String%
Edits the system property with the given key. This expression supports getting, setting and deleting.
Returns a string.
Type
type
Provides the class
object of a type from its type name. Some example type names are shown below:
string
number
integer
object
list
executable
error
Third-party libraries may register additional types.
These type names refer to the ones used in %Input%
inputs in syntax. Types may inherit each other, and all types inherit object
.
Not all types are provided as simple named expressions. You can also obtain the value using the get_class
function.
Returns a class.
Collections
A set of expressions relating to collection types (lists, maps, arrays, etc.)
Implicit Array Creator
(%Object%, %Object%, ...)
Creates an unmodifiable array with the given arguments in. Useful for creating in-line collections for loops and function calls.
An array is a special type of collection with a fixed size.
Returns an array.
Explicit Array Creator
[a] new array of (%Object%, %Object%, ...)
Creates an unmodifiable array with the given arguments in. Useful for creating in-line collections for loops and function calls.
An array is a special type of collection with a fixed size.
Returns an array.
New List
[a] new list
Creates a modifiable list. This can hold any type of object.
Returns a list.
New Map
[a] new map
Creates a modifiable map. This can hold any type of object in a key - value structure.
Returns a map.
Index of List
index %Number% in [list] %List%
Returns the value at the given index of the list. If this index is greater than the size of the list (- 1) an error will be thrown.
List indices start at zero.
Returns an object.
Key in Map
%Object% in [map] %Map%
Returns the value for the given key in the map. If the map has no entry for this key, it will return null
. This may be set to a value.
Returns an object.
Size of Collection
the size of %Object%
Returns the size of the list, map, array, etc.
Returns a number.
Otherwise
Binary Otherwise
%Object% (otherwise|?) %Object%
Returns the first entry if it exists (not-null) otherwise the second entry.
Returns one of the two objects.
Ternary Otherwise
if %Boolean% then %Object% otherwise %Object%
%Boolean% ? %Object% : %Object%
If the boolean is true, returns the first entry. If the boolean is false, returns the second entry.
Returns one of the two objects.
Last updated