mIRC Home    About    Download    Register    News    Help

Print Thread
#205080 12/10/08 12:00 AM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
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:

Code:
alias timecheck1 { 
  .timer 1 60 .timecheck2 
}

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

Mpot #205081 12/10/08 12:13 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Since you know the time that the /flash command is to run, why not do it the simple way
Code:
/timer 20:50 1 0 flash -r10 UNBANNED


RusselB #205082 12/10/08 12:15 AM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
...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.

Mpot #205086 12/10/08 12:12 PM
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
Then I'd compare 2 ctime values: the current vs. a calculated one
Code:
; 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

Mpot #205090 12/10/08 03:58 PM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
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.

RusselB #205101 12/10/08 08:55 PM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
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?

Mpot #205103 12/10/08 09:27 PM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
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.


Link Copied to Clipboard