HyperScript
Docs

← All of the Docs The basics

File structure

Guide and examples

How syntax is written on these pages. <name> stands for a value you put there. Something in square brackets, such as [or drop], may be left out. Round brackets with a slash, such as (below/above), mean one of those words. Everything else is written as it stands.

A script is a list of commands, event handlers, timers and functions. Blocks are formed by indentation (spaces or tabs, as long as you are consistent), and every line that opens a block ends with :.

A line that ends with a backslash carries on with the next one, so long text or a long condition can be spread over several lines:

on player join:
    send "&7Welcome to the server. Read the rules, " + \
        "be kind to each other, and have fun."

# starts a comment: everything after it on the line is ignored, so it is where you leave notes for yourself and for whoever edits the script next. A # inside quotes is ordinary text.

# Notes
#  - The reward is the number in /daily. Change it there.

options:
    <name>: <value>

function <name>(<locals>):
    <statements>

on load:
    <statements>

on <event>:
    <statements>

command /<name> [<argument description>]:
    <options>
    trigger:
        <statements>

every <duration>:
    <statements>

on discord command "/<name>":
    <statements>

on load: is not a server event. Its block runs once each time the file is loaded: when the server starts, on /hyperscript reload, and when the file is saved with hot reloading on. It runs with no player, like a console command, and after every script has been loaded, so it may call functions from other files. It is the place to set defaults and create teams:

on load:
    if {motd} is not set:
        set {motd} to "&aWelcome!"