What is the best way to make a timer? I want something that displays mm:ss in the action bar of the player and counts down. I was thinking of trying to do something like set variable to 5 minutes from now, loop through the duration and for every 1 second, check if tthe time now is the same as the variable that is set to the timer in 5 minutes. Does that seem okay or am i wrong here?
#best way to make a timer
1 messages · Page 1 of 1 (latest)
You can just while {} > now:
great idea. My implementation doesnt quite work. The line set {_end} to {_duration} seconds from now doesnt work- says script can't understand this expression. If I replace duration with 10 just for testing, it seems like the while loop doesn't run either
function start_mine_timer(p: player, duration: number):
set {_end} to {_duration} seconds from now
broadcast "player is %{_p}% and duration is %{_duration}%, end time is %{_end}%"
while {_end} is less than now:
set {_remaining} to difference between now and {_end}
send "there is still %{_remaining}% remaining!" to {_p}
wait 1 second