⌘K

Built-in Functions

Updated 25 Mar 2026

Call these directly in any expression — no define block needed. They work in set, if, send, arguments, and anywhere else an expression is valid.

String functions

FunctionDescription
len(s)Length of string
upper(s)Uppercase
lower(s)Lowercase
trim(s)Strip leading/trailing whitespace
substr(s, start, end)Substring (0-indexed)
replace(s, find, replacement)Replace all occurrences
contains(s, sub)true if s contains sub
startswith(s, prefix)true if s starts with prefix
endswith(s, suffix)true if s ends with suffix

Math functions

FunctionDescription
abs(n)Absolute value
floor(n)Round down
ceil(n)Round up
round(n)Round to nearest integer
min(a, b)Smaller of two values
max(a, b)Larger of two values
sqrt(n)Square root
pow(base, exp)Exponentiation
random(min, max)Random integer between min and max (inclusive)
set $msg = lower($message)
if contains($msg, "badword"):
    cancel_event
    send "&cWatch your language!"

set $result = random(1, 6)
broadcast "&e" + player.name + " rolled a " + $result + "!"