ScoreTimerModule constructor
ScoreTimerModule(})
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);
}