mIRC Home    About    Download    Register    News    Help

Print Thread
/timer $+ $ctimer off #264498 09/12/18 02:25 AM
Joined: Jan 2004
Posts: 1,228
maroon Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,228
/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.

Code:
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:
  timerx?
  var %a | echo -a command line of ctimer $qt($ctimer) -> $timer( $timer($ctimer).name ).com
}

Last edited by maroon; 09/12/18 02:39 AM.
Re: /timer $+ $ctimer off [Re: maroon] #264502 09/12/18 09:16 AM
Joined: Dec 2002
Posts: 4,587
Khaled Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 4,587
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.

Re: /timer $+ $ctimer off [Re: Khaled] #264509 09/12/18 07:52 PM
Joined: Jan 2004
Posts: 1,228
maroon Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,228
Yes, this looks like it's largely about that issue in
https://forums.mirc.com/ubbthreads.php/topics/261772/$timer()_returning_info_about_#Post261772

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.