mIRC Home    About    Download    Register    News    Help

Print Thread
timer help #247714 23/08/14 11:35 AM
Joined: Oct 2005
Posts: 71
D
D00M Offline OP
Babel fish
OP Offline
Babel fish
D
Joined: Oct 2005
Posts: 71
Hey guys, I'm trying to make a script where it will check if a timer is already on/off and display a msg to the channel saying it is but I cant seem to work it out. I've tried adding the checks for it to see if the timer is on or off already but all I get is either errors in my status window or it doesn't work. At the moment when an op types in !timer1 on, if it is already on it just says "Timer1 script has been Enabled" each time the trigger is typed because there is no check to see if it is actually on already (same with !timer1 off).

Code:
on *:TEXT:!timer1 on:#: {
  if ($nick isop #) {
   timer1 0 300 do something
    msg # - Timer1 script has been Enabled
  }
 else msg # Timer1 is already enabled
}
on *:TEXT:!timer1 off:#: {
  if ($nick isop #) {
    timer1 off
    msg # - Timer1 script has been Disabled
  }
 else msg # Timer1 is already disabled
}



Also how would I make it so if the bot gets disconnected and the script is on, it doesn't keep saying in the status window that the bot isn't connected in the channel. Something that checks if the script is on when the bot gets disconnected and to turn it off until it reconnects to the server/channel (but only if the script is actually on when it gets disconnected).

Thanks guys hope you can help,

D00M

Last edited by D00M; 23/08/14 11:40 AM.
Re: timer help [Re: D00M] #247715 23/08/14 03:32 PM
Joined: Jul 2006
Posts: 3,559
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,559
Due to a limitation of the design, you can't name your timer with a number if you want to use $timer(), which is what you need to check if a timer is running, rename your timer to something else than "1" (for exampe /.timermytimer 0 300 do something) then if ($timer(mytimer)) {

Timer by default are associated with the current connection they are created on, by default, they will also be stopped if you are disconnected so that should not be a problem


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: timer help [Re: Wims] #247719 23/08/14 06:08 PM
Joined: Oct 2005
Posts: 71
D
D00M Offline OP
Babel fish
OP Offline
Babel fish
D
Joined: Oct 2005
Posts: 71
Nice one Wins ,thanks for clearing that up for me. Works a treat now that I named the timer and used $timer(). Again thank you very much,

D00M.