|
Will this work?
#205080
12/10/08 12:00 AM
|
Joined: Apr 2007
Posts: 228
Mpot
OP
Fjord artisan
|
OP
Fjord artisan
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: alias timecheck1 {
.timer 1 60 .timecheck2
}
alias timecheck2 {
if ($time < 20:50:01) { .timecheck1 }
elseif ($time > 20:50:01) { /flash -r10 UNBANNED | halt }
}
|
|
|
Re: Will this work?
[Re: Mpot]
#205081
12/10/08 12:13 AM
|
Joined: Aug 2004
Posts: 7,252
RusselB
Hoopy frood
|
Hoopy frood
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 /timer 20:50 1 0 flash -r10 UNBANNED
|
|
|
Re: Will this work?
[Re: RusselB]
#205082
12/10/08 12:15 AM
|
Joined: Apr 2007
Posts: 228
Mpot
OP
Fjord artisan
|
OP
Fjord artisan
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.
|
|
|
Re: Will this work?
[Re: Mpot]
#205086
12/10/08 12:12 PM
|
Joined: Nov 2006
Posts: 1,559
Horstl
Hoopy frood
|
Hoopy frood
Joined: Nov 2006
Posts: 1,559 |
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) 
|
|
|
Re: Will this work?
[Re: Mpot]
#205090
12/10/08 03:58 PM
|
Joined: Aug 2004
Posts: 7,252
RusselB
Hoopy frood
|
Hoopy frood
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.
|
|
|
Re: Will this work?
[Re: RusselB]
#205101
12/10/08 08:55 PM
|
Joined: Apr 2007
Posts: 228
Mpot
OP
Fjord artisan
|
OP
Fjord artisan
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?
|
|
|
Re: Will this work?
[Re: Mpot]
#205103
12/10/08 09:27 PM
|
Joined: Aug 2004
Posts: 7,252
RusselB
Hoopy frood
|
Hoopy frood
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.
|
|
|
|
|
|