mIRC Homepage
Posted By: danzigrules login timer - 05/12/06 10:30 AM
I was wondering how to go about writing a script that users could type !logout, would start an 18 hour countdown timer. Then be able to type !time, to see how much time was left. Then !login to shut the timer off.

Thanks
Posted By: Riamus2 Re: login timer - 05/12/06 02:47 PM
Use this:

Code:
on *:text:*:#: {
  if ($1 == !logout) {
    .timerlogout 1 64800 msg $chan Logged Out.
    msg $chan Starting logout.
  }
  elseif ($1 == !login) {
    if ($timer(logout)) {
      .timerlogout off
      msg $chan Logout terminated.
    }
    else msg $chan Not logging out.
  }
  elseif ($1 == !time) {
    if ($timer(logout)) {
      msg $chan $duration($timer(logout).secs) left until logged out.
    }
    else msg $chan Not logging out.
  }
}


Note that you can change the messages if you want.
Posted By: danzigrules Re: login timer - 05/12/06 03:33 PM
WOW

I figured I would just get some help with it, not it wrote out for me. laugh

Thank you VERY much
Posted By: Riamus2 Re: login timer - 05/12/06 10:30 PM
Heh. No problem. If you want an explanation of what it does, just ask. smile
Posted By: RusselB Re: login timer - 06/12/06 01:45 AM
Please note that Riamus' code is a general code, not one that tracks on a nick by nick basis. This means that if Person1 does !logout and then half an hour later Person2 does !logout, the logout timer will reset to the start point from when Person2 issued the command, so the logout message would be given 18 hours after that, not 18 hours after Person1 used the command.
Posted By: danzigrules Re: login timer - 06/12/06 03:12 AM
Originally Posted By: RusselB
Please note that Riamus' code is a general code, not one that tracks on a nick by nick basis. This means that if Person1 does !logout and then half an hour later Person2 does !logout, the logout timer will reset to the start point from when Person2 issued the command, so the logout message would be given 18 hours after that, not 18 hours after Person1 used the command.


oh, I did not know this, would it be a long pain to code it so that each persons timer would be separate?

Thanks again
Posted By: RusselB Re: login timer - 06/12/06 04:58 AM
Not at all..Here you go
Code:
on *:text:*:#: {
  if ($1 == !logout) {
    $+(.timerlogout,$nick) 1 64800 msg $chan Logged Out.
    msg $chan Starting logout.
  }
  elseif ($1 == !login) {
    if $timer($+(logout,$nick)) {
      $+(.timerlogout,$nick) off
      msg $chan Logout terminated.
    }
    else msg $chan Not logging out.
  }
  elseif ($1 == !time) {
    if $timer($+(logout,$nick)) {
      msg $chan $duration($timer($+(logout,$nick)).secs) left until logged out.
    }
    else msg $chan Not logging out.
  }

© mIRC Discussion Forums