There is nothing wrong with that, its due to the way things work in mirc
When you set up a -z on a variable it decreases by one at the turn of the next second, AND if you set up a timer to go off once a second, it also goes off at the turn of the second (folowing -z being done) HOWEVER if the second that your in has less than around 90% of it left at the time u set the timer it well not go off at that second change over, but at the next.
At 12:00:00.250 u do a /dec -z %x then at 12:00:01.000 %x well be decreased
At 12:00:00.250 u do a /timer 3 1 echo %x then at 12:00:02.000, 12:00:03.000 & 12:00:03.000 this well go off
This is the cause of your initial double decreament, the -z goes off while the timer is delayed to the next cycle.
Using the -s option to display the effects of the /SET and /DEC you can see whats happening a bit clearer. and the -t opetion of echo
(i have a custom timer running producing to the ms timestamps so you well not be able to reproduce the exactness in your /echo -t)
//var %ticks = $ticks | set -s %x 6 | echo -at %x , ticks = $calc($ticks - $ticks) | dec -sz %x 2 | echo -at %x , ticks = $calc($ticks - $ticks) | .timer 3 1 echo -at $eval(%x,0) , ticks = $!calc($ticks - %ticks )
* Set %x to 6
[12:14:42.719] 6 , ticks = 0
* Dec %x to 4
[12:14:42.719] 4 , ticks = 0
* Dec %x to 3 12:14:43.188
* Dec %x to 2 12:14:44.188
[12:14:44.188] 2 , ticks = 1484
* Dec %x to 1 12:14:45.188
[12:14:45.188] 1 , ticks = 2484
* Unset %x 12:14:45.188
[12:14:46.188] , ticks = 3484
The red timming values were added to show when the auto dec and unsets occured.
As you can see the -z decrment and the timers are going off 0.188 seconds after the second, rather than at .000, this is likely due to other activities mirc is also doing going before them, but essentially, its a regulated time.
Notice the first dec of %x occurs as 42 seconds rolls to 43, but the first timer event only goes off at 43 rolling to 44 (after the 2nd dec %x).
The ticks count shows you that the first timer event went off 1.484 seconds after the timer was created, but following events went off 1 second after each other.
*** dont know if u needed this but incase ***
If your dec -z a value and also wanting to display its count down, I would suggest you simply do soemthing like this
//set -s %x 6 | echo -a %x | dec %x 2 | echo -a %x | .timer 3 1 dec %x $(|,) echo -at $eval(%x,0)
$(|,) creates a command sepearator inside the timer command, its the same as your $eval(%x,0)