โฒ๏ธ Schedule#

#bs.schedule:help

Module to schedule the execution of commands. Unlike the vanilla schedule command, this system allows the user to schedule commands (and not only functions) and it is possible to schedule several times the same command.


๐Ÿ”ง Functions#

You can find below all the function available in this module.


Schedule#

#bs.schedule:schedule

Allows to schedule a command. If a command is registered in a tick where commands are already registered, adds the command after those already registered.

Inputs
(macro variable) id: string

An ID to identify the command (not necessarily unique).

(macro variable) command: string

The command to schedule.

(macro variable) time: integer

The time to wait before the execution of the command. In ticks by default if unit is not defined.

(macro variable) unit: string (optional)

The unit of the specified time. Possible values: โ€˜tickโ€™, โ€˜secondโ€™, โ€˜minuteโ€™, โ€˜hourโ€™, โ€˜tโ€™, โ€˜sโ€™, โ€˜mโ€™, โ€˜hโ€™.

(macro variable) selector: string (optional)

A selector for the command to be executed as. Only one entity is allowed.

Examples

Example to execute say foo in 5 ticks:

function #bs.schedule:schedule { unit: "tick", id: "foo", time: 5, command: "say foo" }

Example to execute kill @e[type=slime] in 2 minutes:

function #bs.schedule:schedule { unit: "minute", id: "foo", time: 2, command: "kill @e[type=slime]" }

Example to execute say @s as @s in 2 seconds:

function #bs.schedule:schedule { unit: "s", id: "foo", time: 2, command: "say @s", selector: "@s" }

Credits: theogiraudet, Aksiome


Clear#

#bs.schedule:clear

Remove all scheduled commands.

Examples

To remove all commands:

function #bs.schedule:clear

Credits: theogiraudet, Aksiome


Cancel#

#bs.schedule:cancel_all

Allows to cancel a scheduled command. If several commands have the same ID, cancels all of them.

Inputs
(macro variable) id: string

The ID of the command the cancel.

Examples

Example to cancel all commands with the ID โ€œfooโ€:

function #bs.schedule:cancel_all { id: "foo" }

#bs.schedule:cancel

Allows to cancel a scheduled command. If several commands have the same ID, cancels only the command to be executed earliest.

Inputs
(macro variable) id: string

The ID of the command the cancel.

Examples

Example to cancel next command with the ID โ€œfooโ€:

function #bs.schedule:cancel { id: "foo" }

Credits: theogiraudet, Aksiome


๐Ÿ’ฌ Did it help you?

Feel free to leave your questions and feedbacks below!