HyperScript
Docs

Cheat sheet

The most-used syntax on one page. Everything here, and everything else, is on the Docs page with examples.

A script file

# Notes about the script
options:
    prefix: "&8[&6Shop&8] "

command /hello <target:player>:
    permission: "hello.use"
    cooldown: 10 seconds
    trigger:
        send "{@prefix}&aHello!" to arg.1

on player join:
    send "&aWelcome, %player.name%!"

every 5 minutes:
    broadcast "&7Remember to vote!"

function double({_n}):
    return {_n} * 2

Variables and values

WriteMeaning
{name}Saved, shared by every script
{%player%.name}Saved, each player's own
{_name}For this run only
{@name}A setting from options:
"%player.name% has %{%player%.coins}%"Values inside text
set, add ... to, subtract ... from, deleteChange a variable
[1, 2, 3], append x to, size of, item 1 ofLists
5 minutes, now, player's location, 1 diamond swordDurations, dates, places, items

Deciding and repeating

WriteMeaning
if ...: / else if ...: / else:Choose
unless ...:The opposite of if
switch arg.1: with case "a": and default:One of many
randomly: with 70%:, 30%:One of several, by chance
loop 5 times: / for each {_x} in <list>: / while ...:Repeat; else: under a loop runs when it never went round
loop from 1 to 10: / loop from 10 to 0 by 2: / loop {_list}:Count, or go through a list
loop-value / loop-indexWhat the loop is on, and which round it is; in a loop inside a loop loop-value-1, loop-value-2
loop all players: with loop-player (or loop player)Everyone online
loop all players with permission "staff": / loop {_list} where ...:Some of them only
loop blocks within 3 blocks of player:Every block around a place
break / continue / stopLeave a loop, skip a round, end the trigger
stop if ... / continue if ... / break unless ...The same, on one line with its condition
after 5 seconds:Run a block later and carry on now
wait 5 seconds / wait until ...Pause
try: / on error:Deal with a failure

Common conditions

WriteMeaning
== != < > is is notCompare
is set / is not setHas a value
contains, starts with, is in <list>Text and lists
player has permission "x"Permissions
player has 5 diamondInventory
player is sneaking, is op, is onlinePlayer state
chance of 25%At random
and, or, notCombine

Common effects

WriteMeaning
send "..." [to <who>] / broadcast "..."Chat
send title "...", send action bar "..."On screen
give 1 diamond to player / remove 1 diamond from playerItems
teleport player to <location>Move
heal player, feed player, kill playerHealth
apply speed 2 to player for 30 secondsPotion effects
set gamemode of player to creativeGame mode
play sound "..." at player's locationSound
execute console command "..."Any other command
cancel eventStop what the event is about
open gui with title "..." for player: with slot 1 is "diamond":Menus