⏲️ Schedule#
#bs.schedule:help
Enhance command scheduling with this module, providing flexibility beyond vanilla capabilities. Cancel commands and maintain execution context (entity & location).
🔧 Functions#
You can find below all functions available in this module.
Cancel#
- #bs.schedule:cancel_all {with:{}}
Cancel all scheduled commands that match the given ID.
- Inputs:
Function macro:
- Arguments
- with: Cancel filters.
- id: Scheduled command parameter to match against.
- with: Cancel filters.
- Arguments
Cancel all commands that have an id
parameter set to “foo”:
function #bs.schedule:cancel_all {with:{id:"foo"}}
- #bs.schedule:cancel_one {with:{}}
Cancel the first scheduled command that match the given ID.
- Inputs:
Function macro:
- Arguments
- with: Cancel filters.
- id: Scheduled command parameter to match against.
- with: Cancel filters.
- Arguments
Cancel the next command that have an id
parameter set to “foo”:
function #bs.schedule:cancel_one {with:{id:"foo"}}
Credits: Aksiome, theogiraudet
Clear#
- #bs.schedule:clear
Clear all scheduled commands.
Remove all scheduled commands:
function #bs.schedule:clear
Credits: Aksiome, theogiraudet
Schedule#
- #bs.schedule:schedule {with:{}}
Schedule a command for execution. If a command is registered in a tick where commands are already registered, adds the command after those already registered.
- Inputs:
Function macro:
- Arguments
- with: Schedule data.
- command: Command to schedule.
- time: Time to wait. In ticks by default if unit is not defined.
- unit: Unit of the specified time (tick, second, minute, hour, t, s, m, h).
- id: Optional parameter used to identify the scheduled command.
- with: Schedule data.
- Arguments
- Outputs:
Return: A unique identifier for the scheduled command.
Execute say foo
in 2 seconds:
function #bs.schedule:schedule {with:{command:"say foo",time:2,unit:"s"}}
Schedule then cancel commands that match a complex ID:
function #bs.schedule:schedule {with:{id:{foo:"bar",fails:true},command:"say failure",time:10,unit:"s"}}
function #bs.schedule:schedule {with:{id:{foo:"bar"},command:"say success",time:10,unit:"s"}}
function #bs.schedule:cancel {with:{id:{fails:true}}}
Credits: Aksiome, theogiraudet
💬 Did it help you?
Feel free to leave your questions and feedbacks below!