mIRC Home    About    Download    Register    News    Help

Topic Options
#264498 - 09/12/18 02:25 AM /timer $+ $ctimer off
maroon Offline
Hoopy frood

Registered: 12/01/04
Posts: 1036
/timer off is not consistent when the current timer ($ctimer) is disabled specifically by name or as part of a wildcard.

The current timer does get deleted by the /timer off command, and after being deleted it does not respond to /timer -e. But the difference is whether the $ctimer timer appears in a listing of active timers while the $ctimer timer is running, whether the $timer().prop's return values for the current timer, and whether the $ctimer identifier becomes $null

This /test_timeroff alias defaults to disable both timerX8 and timerX9 by name unless its $1 is non-zero - in which case it instead disables the wildcard pattern X*

/timerX8 1 1 test_timeroff
/timerX9 1 1 test_timeroff

Both of the above commands delete X8 and X9 specifically by name, and both will show the calling timer as part of the existing X* timers, and report .prop values belonging to that timer.

/timerX9 1 1 test_timeroff 1

... changes behavior only by deleting the timers using the "/timerX? off" wildcard. Because the current timer was disabled using a wildcard it is not displayed as an active timer, none of the $timer .prop's return any values for it, and the $ctimer identifier is now $null.

I'm assuming the design behavior is that $ctimer not become $null in this case, and I'm guessing that, since an effort was made to have timeroff give special handling to the current timer, the intent was to have the same thing when it was disabled as part of a wildcard.

alias test_timeroff {
  if ($caller != timer) { timerx9 2 5 echo -a message from x9 $(|) test_timeroff $1 | return }
  echo 3 -a ctimer => $ctimer
  if ($1) {
    echo -a timers turned off: wildcard x?
    timerx? off
  else {
    echo -a timers turned off: x8 x9
    timerx8 off | timerx9 off
  .timerx2 1 1 noop
  echo -a display active timers matching x? wildcard:
  var %a | echo -a command line of ctimer $qt($ctimer) -> $timer( $timer($ctimer).name ).com

Edited by maroon (09/12/18 02:39 AM)

#264502 - 09/12/18 09:16 AM Re: /timer $+ $ctimer off [Re: maroon]
Khaled Offline

Planetary brain

Registered: 04/12/02
Posts: 4326
Loc: London, UK
Thanks for your bug report. This sounds like the same issue that you have mentioned before, ie. that $timer() may list a timer that has been halted if it is used immediately, in the same instance, after the halt. This is a known issue and is on the to-do list.

#264509 - 09/12/18 07:52 PM Re: /timer $+ $ctimer off [Re: Khaled]
maroon Offline
Hoopy frood

Registered: 12/01/04
Posts: 1036
Yes, this looks like it's largely about that issue in

However at that time, I was not aware of the different behavior from deleting the timer as part of a wildcard pattern, or that deleting the current timer via wildcard also causes $ctimer to become $null within that timer. So i guess this thread is just another note to add to that todo item.

$caller continues to report 'timer' after $ctimer becomes $null, but I'm assuming that older aliases have been written to check $ctimer to see if they're running from a timer or not.