It works like this:
!time 200
Then a timer will start counting down from 200 till 0. When the timer reaches 0 you will receive a message that your timer reached zero.
on *:playend: {
.remove count.txt
.msg %x The countdown has reached zero!
.enable #countdown
}
#countdown on
on *:text:$($strip(!time *)):#: {
if (!%f) { inc -u3 %f
if (($2 > 0) && ($2 > 1)) {
if ($2 !isnum) {
.msg # * Error: !time NumberHere $&
(must be followed by a number!)
}
else {
$iif(!%x,set -e %x #)
var %c $regsubex($str(.,$2),/./g,$+($chr(32),\n)))
tokenize 32 $sorttok(%c,32,nr) | .disable #countdown
.msg %x $1 | write count.txt $* | .play %x count.txt 2000
}
}
else { .msg # * The number must be bigger than 0 and 1! }
}
}
#countdown end