
Command
/schedule
Runs a function, or all functions in a function tag, after a delay, or cancels a scheduled function.
| /schedule clear <function> |
| /schedule function <function> <time> [(append|replace)] |
| Argument | Kind of value | What to type |
|---|---|---|
| <function> | Id | For schedule function: the id of the function to run, or a function tag written with a leading #. For schedule clear: the id of the scheduled function to cancel. |
| <time> | Time | How long to wait, counted from now. A number with an optional unit: t (ticks, default), s (seconds) or d (in-game days). Must be at least 1 tick. At least 0. |
| Permission level | 2: operators, worlds with cheats on, command blocks and functions |
| Works in | Singleplayer with cheats enabled, multiplayer servers, command blocks and functions. Needs permission level 2 (gamemasters): operators, players in a world with cheats enabled, command blocks and functions. |
| Result | schedule function reports "Scheduled function ... in N tick(s) at gametime T" (or "Scheduled tag ...") and returns the game time, in ticks, at which it will run. schedule clear reports "Removed N schedule(s) with ID ..." and returns the number of schedules removed. |
| Time units | The time is a number followed by a unit: t for ticks (also the default when no unit is written), s for seconds (20 ticks) and d for in-game days (24000 ticks). Decimals are allowed and are rounded to whole ticks, for example 1.5s is 30 ticks. |
| No zero delay | A time of 0 fails with "Can't schedule for current tick". The shortest delay is 1 tick. |
| replace and append | replace is the default: any existing schedule of the same function or tag is removed and only the new one remains. append keeps the existing schedules and adds another one, so the function can run several times. Two schedules of the same function for the exact same tick count as one. |
| Function tags | Write a # before the id to schedule every function in a function tag, for example #mypack:waves. |
| Macros | A function that uses macro lines cannot be scheduled: "Can't schedule a macro". |
| clear | schedule clear removes all pending schedules of the given function id. If there are none it fails with "No schedules with ID ...". The argument is a plain id; it does not accept the # form. |
| Schedules are saved | Pending schedules are stored with the world and survive closing and reopening it. |
/schedule function mypack:start 5sRuns the function mypack:start 5 seconds from now.
/schedule function mypack:tick_slow 100tRuns the function 100 ticks (5 seconds) from now, replacing any earlier schedule of it.
/schedule function mypack:reminder 30s appendAdds another run in 30 seconds without removing schedules that already exist.
/schedule function #mypack:waves 1d replaceRuns every function in the tag mypack:waves one in-game day (20 minutes) from now.
/schedule clear mypack:startCancels all pending runs of the function mypack:start.

