mIRC Home    About    Download    Register    News    Help

Print Thread
#165989 05/12/06 10:30 AM
Joined: Dec 2006
Posts: 46
D
Ameglian cow
OP Offline
Ameglian cow
D
Joined: Dec 2006
Posts: 46
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

danzigrules #166016 05/12/06 02:47 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
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.


Invision Support
#Invision on irc.irchighway.net
Riamus2 #166026 05/12/06 03:33 PM
Joined: Dec 2006
Posts: 46
D
Ameglian cow
OP Offline
Ameglian cow
D
Joined: Dec 2006
Posts: 46
WOW

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

Thank you VERY much

danzigrules #166069 05/12/06 10:30 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Heh. No problem. If you want an explanation of what it does, just ask. smile


Invision Support
#Invision on irc.irchighway.net
danzigrules #166081 06/12/06 01:45 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
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.

RusselB #166086 06/12/06 03:12 AM
Joined: Dec 2006
Posts: 46
D
Ameglian cow
OP Offline
Ameglian cow
D
Joined: Dec 2006
Posts: 46
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

danzigrules #166091 06/12/06 04:58 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
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.
  }



Link Copied to Clipboard