ScoreTimerModule constructor

ScoreTimerModule(
  1. String name, {
  2. Widget? child,
  3. Entity? selector,
  4. int steps = 1,
  5. String path = 'timers/',
  6. required Time ticks,
  7. int start = 0,
})

The ScoreTimerModule implements a continuous timer with a delay of a number of ticks. It therefore uses a Score to count up or down in steps and resets to the start value afterwards.

To work probably this has to be executed every tick or added to the Packs modules.

constructor
String the name of the Timer and the Scoreboard
ticks the delay as Time between each execution(required)
child a Widget that is executed after the delay
steps the number that it counts up every time(default = 1)
start a number that is used to reset the timer after the delay(default = 0)
selector a custom selector to hold the score (default = playername of name)
path a custom path to hold the required function(default = timers/)

Example:

ScoreTimerModule(
          'timer1',
          ticks: 200.ticks, // 10sec
          child: Log('Timer triggered'),
          steps: 1,
          start: 0,
)

Implementation

ScoreTimerModule(
  this.name, {
  this.child,
  this.selector,
  this.steps = 1,
  this.path = 'timers/',
  required this.ticks,
  this.start = 0,
}) {
  selector ??= Entity.PlayerName(name);
  _score = Score(selector!, name);
}