Ability to add offset to timer trigger
puchm opened this issue ยท 0 comments
I think it would be great to be able to add an offset to a timer trigger like so:
every 20 ticks with offset 5 do
(Or with a similar syntax)
I think this could have several great use cases, a big one for me being lag optimization.
One way that I have found to optimize programs is to divide and conquer. Instead of supplying 1000 machines with resources every 20 ticks I can divide them into 10 groups and execute each of them at different points in time. However, as of right now every timer trigger with the same interval runs it's block in the exact same tick.
The only way to run blocks in different ticks is to have slight offsets in the intervals, i.e. to have one that runs every 20 ticks, one that runs every 21 ticks and so on. Perhaps there is another way using redstone but that can become pretty complex. The way to have offsets in the intervals is not a very elegant solution. Being able to add an offset would enable the user to run all of them every 20 ticks but do so in sequence.
For example:
every 20 ticks do
would run in ticks 0, 20, 40, 60 and so on
every 20 ticks with offset 5 do
would run in ticks 5, 25, 45, 65 and so on
I obviously know that there are better ways to optimize a program than to do this but this seems like an easy addition that could enable further optimization to even those programs that are already optimized as much as possible.