mIRC Homepage
Posted By: littlecramp how to check whether timer is running? - 19/07/03 03:06 PM
I make a timer called 'main' and i want to check whether this timer is still exist when mirc disconnected. How do go about that? What type of event(s) will cause a timer to cease running?
Posted By: pheonix Re: how to check whether timer is running? - 19/07/03 03:09 PM
Code:
alias ftimer {
  var %i 1
  while (%i <= $timer(0)) {
    /write timer.txt $timer(%i)
    inc %i
  }
  var %result $iif($read(timer.txt,$1,s) != $null,$true,$false)
  .remove timer.txt
return %result
}  

/ftimer main
it will make a list of timers in a .txt and then delete the file after the command smile
thanx codemastr wink
Posted By: codemastr Re: how to check whether timer is running? - 19/07/03 03:11 PM
If you didn't create an offline timer, then yes a timer will stop when you disconnect. To prevent this, when you create the timer add a -o to /timer to tell mIRC it's an offline timer.
So if the timer isn't a offline timer, I've to make it run again when disconnected! thank code and pheonix
Posted By: pheonix Re: how to check whether timer is running? - 19/07/03 03:31 PM
changed code now smile
Posted By: codemastr Re: how to check whether timer is running? - 19/07/03 04:41 PM
The file will never be deleted.
$iif($read(timer.txt,$1,s) != $null,return $true,return $false)
.remove timer.txt

Return is called before the remove is executed. Although I think writing it to a file is a horrible way to do this, the correction would be:
var %result = $iif($read(timer.txt,$1,s), $true, $false)
.remove timer.txt
return %result
Error: Unreachable Code seems to come to mind >:D
© mIRC Discussion Forums