trigger:yes · The code to run
command /pay <target:player> <amount:number> [note]:
players only: true
trigger:
subtract arg.2 from {%player%.coins}
add arg.2 to {%arg.1%.coins}Try it← All of the Docs Commands and events
trigger:yes · The code to run
command /pay <target:player> <amount:number> [note]:
players only: true
trigger:
subtract arg.2 from {%player%.coins}
add arg.2 to {%arg.1%.coins}Try itpermission:no · Permission node needed to run the command, or op for server operators only
command /heal:
description: Restore your health
usage: /heal [player]
permission: demo.heal
permission message: "&cYou cannot use /heal."
aliases: h, mend
trigger:
execute console command "effect give %player.name% minecraft:instant_health 1 10"
send "&aHealed."Try itpermission message:no · Shown to players who lack the permission
command /heal:
description: Restore your health
usage: /heal [player]
permission: demo.heal
permission message: "&cYou cannot use /heal."
aliases: h, mend
trigger:
execute console command "effect give %player.name% minecraft:instant_health 1 10"
send "&aHealed."Try itusage:no · Usage text shown in /help
command /heal:
description: Restore your health
usage: /heal [player]
permission: demo.heal
permission message: "&cYou cannot use /heal."
aliases: h, mend
trigger:
execute console command "effect give %player.name% minecraft:instant_health 1 10"
send "&aHealed."Try itdescription:no · Description shown in /help
command /heal:
description: Restore your health
usage: /heal [player]
permission: demo.heal
permission message: "&cYou cannot use /heal."
aliases: h, mend
trigger:
execute console command "effect give %player.name% minecraft:instant_health 1 10"
send "&aHealed."Try italiases:no · Comma-separated alternative names
command /heal:
description: Restore your health
usage: /heal [player]
permission: demo.heal
permission message: "&cYou cannot use /heal."
aliases: h, mend
trigger:
execute console command "effect give %player.name% minecraft:instant_health 1 10"
send "&aHealed."Try itcooldown:no · How long each player must wait between uses, e.g. 30 seconds
on right click:
cooldown: 2 seconds
send "&7Click!"Try itcooldown message:no · Shown to a player who is still waiting; %cooldown% is the time left
command /kit:
cooldown: 1 hour
cooldown message: "&cYou must wait %cooldown% before using this again!"
trigger:
give 1 diamond to playerTry itwarmup:since 1.7.60no · How long a player has to stand still before the trigger runs, e.g. 3 seconds, with the time counting down above the hotbar. Moving or being hurt calls it off. The console does not wait
command /spawn:
warmup: 3 seconds
trigger:
teleport player to {spawn}Try itcost:since 1.7.60no · What running the command costs: 100 of the server's money (with Vault and an economy plugin), or 5 gems of a currency of the script's own. Somebody who has not got it is told so and the trigger does not run; otherwise it is taken first
command /heal:
cost: 50
trigger:
heal player
send "&aHealed."Try itcost message:since 1.7.60no · What they are told then; %cost% is the cost as written
command /feed:
cost: 20
cost message: "&cFood costs %cost% coins."
trigger:
feed playerTry itworlds:since 1.7.64no · The worlds the command works in: worlds: "survival", "resource". Somewhere else the player is told so and the trigger does not run. The console is let through
command /mine:
worlds: "survival", "resource"
trigger:
give 1 iron pickaxe to playerTry itworlds message:since 1.7.64no · What they are told then
command /arena:
worlds: "minigames"
worlds message: "&cThe arena is in the minigames world."
trigger:
send "&aWelcome to the arena."Try ittab complete: <list>since 1.7.1no · What Tab offers for the first argument; tab complete 2: for the second, and so on
command /warp <name>:
tab complete: keys of {warp}
trigger:
teleport player to {warp.%arg.1%}Try itdisabled: truesince 1.7.1no · Keep the command in the file without adding it to the server
command /beta:
disabled: true
trigger:
send "&7Not ready yet."Try itsubcommand <name>:since 1.7.1no · A command inside the command, with options and a trigger of its own
command /team:
subcommand join <red|blue>:
trigger:
add player to team arg.1
subcommand leave:
trigger:
remove player from teamTry itplayers only: truesince 1.7.0no · The console is told it cannot use the command. players only: alone says the same
command /sethome:
players only: true
trigger:
set {%player%.home} to player's locationTry itconsole only: truesince 1.7.0no · Players are told they cannot use the command
command /maintenance:
console only: true
trigger:
set {maintenance} to trueTry it<onsince 1.5.7off>, <red · blue · green>` · Those words
send "&eUsage: /event <on|off>"Try it<player> or <target>since 1.5.7The players who are online
command /greet <player>:
trigger:
send "&aHello from %player.name%!" to arg.1Try it<name:player>since 1.7.0Must be someone who is online; Tab offers their names
command /greet <target:player>:
trigger:
send "&aHello!" to arg.1Try it<name:number>since 1.7.0Must be a number
command /setprice <price:number>:
trigger:
set {price} to arg.1Try it<name:integer>since 1.7.0Must be a whole number. Both kinds of number may be typed short, 1.5k or 2m, and reach the trigger written out
command /roll <sides:integer>:
trigger:
send "&7You rolled " + random integer between 1 and arg.1Try it<name:duration>since 1.7.59Must be a length of time: 30s, 10m, 2h, 1h30m, or a bare number of seconds. In the trigger the argument is that many seconds, so it goes wherever a time does: mute arg.1 for arg.2
command /slow <target:player> <time:duration>:
permission: "staff.slow"
trigger:
set {%arg.1%.slowed} to true for arg.2
send "&7%arg.1% is slowed."Try it<name:boolean>since 1.7.59true, yes or on, or false, no or off; in the trigger it is true or false. Tab offers the two
command /pvp <on:boolean>:
permission: "staff.pvp"
trigger:
set {pvp} to arg.1
send "&7PvP: &f%arg.1%"Try it<name:item>since 1.7.59Must be the name of an item of the game, as in diamond_sword
command /gimme <what:item>:
permission: "staff.gimme"
trigger:
send "&7You asked for &f%arg.1%&7."Try it<name:world>since 1.7.59Must be a world that is loaded; Tab offers their names
command /daytime <where:world>:
permission: "staff.time"
trigger:
set time in world arg.1 to 1000Try it<name:offline player>since 1.7.59Must be somebody who has played here, online or not
command /seen <who:offline player>:
trigger:
send "&7%arg.1% was last on &f%last seen of arg.1%"Try it<name:text>since 1.7.59Everything from there to the end of the line as one argument, spaces and all. It has to be the last one
command /announce <words:text>:
permission: "staff.announce"
trigger:
send "&6[!] &f%arg.1%" to all playersTry it<onsince 1.5.7off>` · One of the words, and nothing else: anything other is answered with the usage
send "&eUsage: /event <on|off>"Try it[name:type]since 1.7.0In square brackets: may be left out, but is checked when given
command /heal [target:player]:
trigger:
if arg.1 is set:
heal arg.1
else:
heal playerTry it[name:type = value]since 1.7.58What the argument is when it is left out: with [amount:number = 1], arg.2 is 1 for a player who gave no amount. Works without a type as well, [note = "a gift"]. Only arguments at the end are filled in
command /coins [amount:number = 1]:
trigger:
add arg.1 to {%player%.coins}
send "&a+%arg.1% coins"Try itcommand /heal:
description: Restore your health
usage: /heal [player]
permission: demo.heal
permission message: "&cYou cannot use /heal."
aliases: h, mend
trigger:
execute console command "effect give %player.name% minecraft:instant_health 1 10"
send "&aHealed."
| Option | Required | Meaning |
|---|---|---|
trigger: | yes | The code to run |
permission: | no | Permission node needed to run the command, or op for server operators only |
permission message: | no | Shown to players who lack the permission |
usage: | no | Usage text shown in /help |
description: | no | Description shown in /help |
aliases: | no | Comma-separated alternative names |
cooldown: | no | How long each player must wait between uses, e.g. 30 seconds |
cooldown message: | no | Shown to a player who is still waiting; %cooldown% is the time left |
warmup: | no | How long a player has to stand still before the trigger runs, e.g. 3 seconds, with the time counting down above the hotbar. Moving or being hurt calls it off. The console does not wait |
cost: | no | What running the command costs: 100 of the server's money (with Vault and an economy plugin), or 5 gems of a currency of the script's own. Somebody who has not got it is told so and the trigger does not run; otherwise it is taken first |
cost message: | no | What they are told then; %cost% is the cost as written |
worlds: | no | The worlds the command works in: worlds: "survival", "resource". Somewhere else the player is told so and the trigger does not run. The console is let through |
worlds message: | no | What they are told then |
tab complete: <list> | no | What Tab offers for the first argument; tab complete 2: for the second, and so on |
disabled: true | no | Keep the command in the file without adding it to the server |
subcommand <name>: | no | A command inside the command, with options and a trigger of its own |
players only: true | no | The console is told it cannot use the command. players only: alone says the same |
console only: true | no | Players are told they cannot use the command |
A number within limits. An argument that is a number can say what it has to lie between: <amount:number 1 to 10000>, <level:integer at least 1>, [percent:number at most 100]. A player who gives another number is told amount must be between 1 and 10000. and the trigger does not run.
command /pay <target:player> <amount:number 1 to 10000>:
trigger:
subtract arg.2 from {%player%.coins}
add arg.2 to {%arg.1%.coins}
send "&aYou paid %arg.1% %money(arg.2)%."
The command line may describe its arguments after the name, as in command /pay <player> <amount>:. It becomes the usage text unless a usage: line is given, and it decides what pressing Tab offers while the command is typed:
| Written in the header | Tab offers | |||
|---|---|---|---|---|
| `<on | off>, <red | blue | green>` | Those words |
<player> or <target> | The players who are online | |||
Anything else, such as <amount> | Nothing |
Subcommands. A command with several jobs can give each one its own block instead of a switch on the first argument. Each subcommand has its own permission, description, checked arguments and trigger, and arg.1 inside it is the first word *after* its name:
command /warp <name>:
tab complete: keys of {warp}
trigger:
teleport player to {warp.%arg.1%}
subcommand set <name>:
permission: "warps.manage"
trigger:
set {warp.%arg.1%} to player's location
send "&aWarp %arg.1% set."
subcommand list:
trigger:
send "&7Warps: &f" + join keys of {warp} with ", "
/warp set base runs the set block; /warp base runs the command's own trigger.tab complete: takes any list and is worked out when Tab is pressed, so it can offer warp names, team names or anything else a script keeps.What Tab offers, argument by argument. tab complete: can also be a block. Its lines run each time Tab is pressed, and set arg.1 to ... in it says what is offered for the first argument, set arg.2 to ... for the second, and so on. The lines are ordinary code, so what is offered for one argument can depend on what was typed for the ones before it:
command /rank [action] [target] [rank]:
permission: "ranks.admin"
tab complete:
set arg.1 to "set", "remove", "list"
set {_online} to server.players
if arg.1 is "set" or arg.1 is "remove":
set arg.2 to {_online}
if arg.1 is "set":
set arg.3 to "owner", "admin", "moderator", "vip"
trigger:
send "&7You typed: %args%"
What stands after to may be values written one after the other, a list, or both.
/rank and pressing Tab offers set, remove and list; after /rank set Steve it offers the ranks; after /rank list nothing, because the block set nothing for that.<player>, the words of <on|off>.arg.1 is what was typed.Checked arguments. Give an argument a type and HyperScript checks it before the trigger runs, answering with what is wrong, and the usage line for a missing argument or a number that is not one:
command /pay <target:player> <amount:number> [note]:
players only: true
trigger:
subtract arg.2 from {%player%.coins}
add arg.2 to {%arg.1%.coins}
| Written in the header | Checked | |
|---|---|---|
<name:player> | Must be someone who is online; Tab offers their names | |
<name:number> | Must be a number | |
<name:integer> | Must be a whole number. Both kinds of number may be typed short, 1.5k or 2m, and reach the trigger written out | |
<name:duration> | Must be a length of time: 30s, 10m, 2h, 1h30m, or a bare number of seconds. In the trigger the argument is that many seconds, so it goes wherever a time does: mute arg.1 for arg.2 | |
<name:boolean> | true, yes or on, or false, no or off; in the trigger it is true or false. Tab offers the two | |
<name:item> | Must be the name of an item of the game, as in diamond_sword | |
<name:world> | Must be a world that is loaded; Tab offers their names | |
<name:offline player> | Must be somebody who has played here, online or not | |
<name:text> | Everything from there to the end of the line as one argument, spaces and all. It has to be the last one | |
| `<on | off>` | One of the words, and nothing else: anything other is answered with the usage |
[name:type] | In square brackets: may be left out, but is checked when given | |
[name:type = value] | What the argument is when it is left out: with [amount:number = 1], arg.2 is 1 for a player who gave no amount. Works without a type as well, [note = "a gift"]. Only arguments at the end are filled in |
An argument without a type is not checked, as before. The types are not shown in the usage line.
A command declared without any arguments keeps the server's default, which is player names. The arguments are still read with %arg.1%, %arg.2% and so on, and are not checked for you.
A short command can also simply use a switch on the first argument, without subcommand blocks:
command /kit <starter|food>:
trigger:
switch arg.1:
case "starter":
give 1 stone sword to player
case "food":
give 16 bread to player
default:
send "&eUsage: /kit <starter|food>"
Commands can be run from the console; there is then no player. players only: true keeps the console out, or test if player is not set: yourself.