I've looked over your code and I'm pretty sure you have it scripted correctly this time. I have a couple of scripting hints, though.
alias xmas {
;
; You are using a / before each command. This is completely unnecessary inside a script. mIRC already knows it's
; supposed to be looking for commands because it is already processing the script, so it's looking for commands.
; The command prefix (which is / by default, but can be changed) is only required when you TYPE a command, not
; inside a script that is filled with nothing but command lines.
;
set %xmas $duration($calc($ctime(25/12/02) - $ctime))
;
if (%xmas < 3600) {
;
; The /timer command is not silent; so, in a script that uses them, silence them by prefacing them with a period
; (full stop), as you did below to set off the next 1 3600 xmas timer.
;
.timerxmas off
.timer 1 %xmas amsg Merry Chistmas
}
;
; You will need to group the following two commands inside an else { } block because you don't want to fire the timer
; again after Christmas has arrived. Otherwise, you'll be telling people once every hour for the next year how close
; they are to NEXT Christmas (before this one has even ended).
;
else {
amsg 00,04 %xmas Until Christmas
.timerxmas 1 3600 xmas
}
}
hmm i was just looking your over ? is there a reason for the < 3601 ? rather than 3600 ?
My previous example used a timer set to fire at a specific time. I didn't want the time to get closer to midnight than 1 second or else I risk the chance that the midnight timer might get set 1 second after the actual midnight I am targetting causing my Merry Christmas timer to actually fire 24 hours minus one second later (this is a special case scenario: the next to the last timer firing at exactly 3600 seconds before midnight). So, I gave it a 1-second buffer. Yours does not work this way since you are using a variable that will eventually be used as the timer duration. mIRC will accept a negative duration for a timer, so there is no problem if yours fires after actual midnight. It can only be as accurate as your system clock; your /amsg might very well arrive at everyone else's clients after that first second of Christmas Day anyway, due to the lag between you, your server, any connecting hubs, their servers and then on to their clients, so exact timing is not that important. Nice, but not essential, nor really possible.
If it were me scripting yours, I would use that same 1-second buffer for basically the same reason.