Pattern
# this file runs every tick (or more slowly using a ticker)
# start
execute if score TL$exampletimeline DatapackManager matches 0.. run scoreboard players add TL$exampletimeline DatapackManager 1
# timeline
execute if score TL$exampletimeline DatapackManager matches <time_in_ticks> run <command>
# end
execute if score TL$exampletimeline DatapackManager matches <end_of_timeline>.. run scoreboard players reset TL$exampletimeline DatapackManager
Benefits
- Works with any ticker to create a timeline of events
- Test if the timeline is running with
execute if score TL$exampletimeline DatapackManager matches 0..
- It uses the quirk that scoreboard reset is not a number and thus will not be flagged by 0..
- Alternatively, select a specific range of the timeline
execute if score TL$exampletimeline DatapackManager matches 100..350
- Laggier but more readable alternative to having hundreds of files scheduled in a linear fashion
- Works on versions without the /schedule function, 1.13
Example use cases
# this file runs every tick (or more slowly using a ticker)
# start
execute if score TL$exampletimeline DatapackManager matches 0.. run scoreboard players add TL$exampletimeline DatapackManager 1
# timeline
execute if score TL$exampletimeline DatapackManager matches 20 run say 3..
execute if score TL$exampletimeline DatapackManager matches 40 run say 2..
execute if score TL$exampletimeline DatapackManager matches 60 run say 1..
execute if score TL$exampletimeline DatapackManager matches 80 run say Go!
# end
execute if score TL$exampletimeline DatapackManager matches 80.. run scoreboard players reset TL$exampletimeline DatapackManager
# start timeline
scoreboard players set TL$exampletimeline DatapackManager 0