mIRC Home    About    Download    Register    News    Help

Print Thread
how to check whether timer is running? #37160 19/07/03 03:06 PM
Joined: Jan 2003
Posts: 127
L
littlecramp Offline OP
Vogon poet
OP Offline
Vogon poet
L
Joined: Jan 2003
Posts: 127
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?

Re: how to check whether timer is running? #37161 19/07/03 03:09 PM
Joined: May 2003
Posts: 2,265
P
pheonix Offline
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
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

Last edited by pheonix; 19/07/03 04:54 PM.

new username: tidy_trax
Re: how to check whether timer is running? #37162 19/07/03 03:11 PM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
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.

Re: how to check whether timer is running? #37163 19/07/03 03:25 PM
Joined: Jan 2003
Posts: 127
L
littlecramp Offline OP
Vogon poet
OP Offline
Vogon poet
L
Joined: Jan 2003
Posts: 127
So if the timer isn't a offline timer, I've to make it run again when disconnected! thank code and pheonix

Re: how to check whether timer is running? #37164 19/07/03 03:31 PM
Joined: May 2003
Posts: 2,265
P
pheonix Offline
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
changed code now smile


new username: tidy_trax
Re: how to check whether timer is running? #37165 19/07/03 04:41 PM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
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

Re: how to check whether timer is running? #37166 20/07/03 02:26 AM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
Error: Unreachable Code seems to come to mind >:D


-KingTomato