mIRC Homepage

Will this work?

Posted By: Mpot

Will this work? - 12/10/08 12:00 AM

I'm trying to figure out how to create a script that checks the $time every minute, and when the $time is right, it /flashs. Will this work:

alias timecheck1 { 
  .timer 1 60 .timecheck2 

alias timecheck2 {
  if ($time < 20:50:01) { .timecheck1 }
  elseif ($time > 20:50:01) { /flash -r10 UNBANNED | halt }
Posted By: RusselB

Re: Will this work? - 12/10/08 12:13 AM

Since you know the time that the /flash command is to run, why not do it the simple way
/timer 20:50 1 0 flash -r10 UNBANNED

Posted By: Mpot

Re: Will this work? - 12/10/08 12:15 AM

...wow. I did overcomplicated that a little, didn't I? While I certainly am going to use the method you suggested, I would be interested to know if the script I came up with would work.
Posted By: Horstl

Re: Will this work? - 12/10/08 12:12 PM

Then I'd compare 2 ctime values: the current vs. a calculated one
; starting a looping timer instead of repetitive calling a 1min timer 
alias StartCheck { .timerCheckTime 0 60 CheckTime }

; checking alias triggered by the looping timer
alias -l CheckTime {
  ; if condition is matched: do stuff and stop the looping timer 
  if ($ctime > $ctime($date 20:50:00)) { 
    flash -r10 UNBANNED 
    .timerCheckTime off

(untested) smile
Posted By: RusselB

Re: Will this work? - 12/10/08 03:58 PM

The best way to see if a script will work or not is to test it.

Depending on how accurately you want/need the time checked, your code could be off by about 1 second.
The code I provided could be off by about 0.5 seconds.
Altering my code to include the 0m switch would make it accurate to about 0.5 milliseconds.
Posted By: Mpot

Re: Will this work? - 12/10/08 08:55 PM

I'm not worried about superb accuracy. Within a second is fine. Thanks, everyone.

I'm going to be needing a socket script again soon, and this time I was wondering, how can I do it myself?
Posted By: RusselB

Re: Will this work? - 12/10/08 09:27 PM

1) Read the section on Sockets in the help file.
2) Search the forum for the term socket
3) Review the scripts that are returned in that search.
4) Make and test your best attempt.
5) Ask here, with a posting of your code, for assistance in getting it working and/or recommended changes to make it faster/better.
© 2022 mIRC Discussion Forums