mIRC Homepage
Posted By: D00M timer help - 23/08/14 11:35 AM
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
Posted By: Wims Re: timer help - 23/08/14 03:32 PM
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
Posted By: D00M Re: timer help - 23/08/14 06:08 PM
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.
© mIRC Discussion Forums