wait <duration>since 1.5.2Any duration: wait 10 ticks, wait 5 seconds, wait 1 minute 30 seconds
wait 3 secondsTry it← All of the Docs The basics
wait <duration>since 1.5.2Any duration: wait 10 ticks, wait 5 seconds, wait 1 minute 30 seconds
wait 3 secondsTry itwait <number> secondssince 1.5.2The number may be a variable: wait {_delay} seconds
set {_delay} to 5
wait {_delay} secondsTry itwait until <condition> [for at most <duration>]since 1.7.0Pause until it is true
wait until block at (location below player's location) is "gold_block" for at most 30 secondsTry itwait between <duration> and <duration>since 1.7.57Pause for some time between the two, another every time: wait between 1 and 3 seconds, wait between 10 ticks and 1 second
command /fish:
trigger:
send "&7You cast the line..."
wait between 2 and 6 seconds
send "&bA bite!"Try itafter <duration>:since 1.7.57Run the block under it that much later, on its own: the lines below the block carry on at once. Inside it the local variables are as they were when the after was reached
on player join:
after 3 seconds:
send "&aWelcome, %player.name%."Try itrun <function>(...) in <duration>since 1.7.0Call a function later
function remind({_who}):
send "&eTime is up!" to {_who}
command /timer:
trigger:
run remind(player.name) in 30 secondsTry itrun <function>(...) in <duration> as <name>since 1.7.1The same, under a name it can be called off by
function end_boost({_who}):
set walk speed of {_who} to 0.2
command /boost:
trigger:
set walk speed of player to 0.4
run end_boost(player.name) in 30 seconds as "boost %player.name%"Try itschedule <function>(...) in <duration>since 1.7.10Like run ... in, but written down: the call still happens after a restart. Add as <name> to be able to replace it or call it off
function end_vip({_who}):
delete {%{_who}%.vip}
send "&7Your VIP time is over." to {_who}
command /vip <target:player>:
permission: "vip.give"
trigger:
set {%arg.1%.vip} to true
schedule end_vip(arg.1) in 30 days as "vip %arg.1%"Try itcancel schedule <name>since 1.7.10Call off a named schedule that has not happened yet
cancel schedule "vip %arg.1%"Try ittime until schedule <name>since 1.7.44How long a named schedule still has; unset if nothing waits under that name, so is set says whether one is pending
set {_left} to time until schedule "restart"Try itcancel run <name>since 1.7.1Call off a named run that has not happened yet
cancel run "boost %player.name%"Try itrepeat every <duration> for <duration>:since 1.7.0Run a block now and then again at each interval
repeat every 1 second for 10 seconds:
send title "&e%{_n}%" to all players
subtract 1 from {_n}Try itcountdown <duration>:since 1.7.52Run a block once a second, with seconds left counting down to 1; what comes after the block runs when it is over
countdown 5 seconds:
send title "&e%seconds left%" to player
send title "&aGo!" to playerTry itonce for <who>:since 1.7.52Run a block the first time only, for each player; else: under it runs every other time
on player join:
once for player:
send "&6Welcome! &7Type /help to get started."Try itonce per day for <who>:since 1.7.52The same once in each day; also per hour, per week, per month, or per 30 minutes for that long after the last time
command /daily:
trigger:
once per day for player:
add 100 to {%player%.coins}
send "&a+100 coins."
else:
send "&7You have had today's reward."Try itonce:since 1.7.52Without for: once for the whole server
on load:
once:
log "This server ran HyperScript for the first time."Try itwait pauses the trigger it is in, then carries on with the next line. Only that trigger pauses; the server and every other script keep running.
command /launch:
trigger:
send "&eLaunching in 3 seconds..."
wait 3 seconds
execute console command "effect give %player.name% minecraft:levitation 2 20"
wait 2 seconds
send "&aEnjoy the view."
| Syntax | Meaning |
|---|---|
wait <duration> | Any duration: wait 10 ticks, wait 5 seconds, wait 1 minute 30 seconds |
wait <number> seconds | The number may be a variable: wait {_delay} seconds |
wait works anywhere, including inside if, loops, GUI click blocks and async:. Local variables keep their values across it.wait, the event that started the trigger is over: cancel event and statements that change the event, such as set join message, no longer have any effect.Waiting for something. wait until pauses until a condition holds, looking again four times a second:
send "&7Stand on the gold block to start."
wait until block at (location below player's location) is "gold_block" for at most 30 seconds
send "&aGo!"
It gives up after the time given with for at most, or after five minutes if none is given, and the script carries on either way; test the condition again afterwards if it matters.
Doing something later, and again. run calls a function after a delay without making the rest of the trigger wait, and repeat runs a block at intervals for a while:
function unfreeze_later({_who}):
unfreeze {_who}
send "&aYou can move again." to {_who}
command /timeout <player>:
permission: "staff.timeout"
trigger:
freeze arg.1
run unfreeze_later(arg.1) in 30 seconds
command /countdown:
trigger:
set {_n} to 10
repeat every 1 second for 10 seconds:
send title "&e%{_n}%" to all players
subtract 1 from {_n}
| Syntax | Effect |
|---|---|
wait until <condition> [for at most <duration>] | Pause until it is true |
wait between <duration> and <duration> | Pause for some time between the two, another every time: wait between 1 and 3 seconds, wait between 10 ticks and 1 second |
after <duration>: | Run the block under it that much later, on its own: the lines below the block carry on at once. Inside it the local variables are as they were when the after was reached |
run <function>(...) in <duration> | Call a function later |
run <function>(...) in <duration> as <name> | The same, under a name it can be called off by |
schedule <function>(...) in <duration> | Like run ... in, but written down: the call still happens after a restart. Add as <name> to be able to replace it or call it off |
cancel schedule <name> | Call off a named schedule that has not happened yet |
time until schedule <name> | How long a named schedule still has; unset if nothing waits under that name, so is set says whether one is pending |
cancel run <name> | Call off a named run that has not happened yet |
repeat every <duration> for <duration>: | Run a block now and then again at each interval |
countdown <duration>: | Run a block once a second, with seconds left counting down to 1; what comes after the block runs when it is over |
once for <who>: | Run a block the first time only, for each player; else: under it runs every other time |
once per day for <who>: | The same once in each day; also per hour, per week, per month, or per 30 minutes for that long after the last time |
once: | Without for: once for the whole server |