mIRC Home    About    Download    Register    News    Help

Topic Options
#247714 - 23/08/14 12:35 PM timer help
D00M Offline
Babel fish

Registered: 28/10/05
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


Edited by D00M (23/08/14 12:40 PM)

Top
#247715 - 23/08/14 04:32 PM Re: timer help [Re: D00M]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3465
Loc: France
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

Top
#247719 - 23/08/14 07:08 PM Re: timer help [Re: Wims]
D00M Offline
Babel fish

Registered: 28/10/05
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.

Top