mIRC Home    About    Download    Register    News    Help

Topic Options
#96378 - 01/09/04 10:30 AM Timed action
dmmrs Offline
Ameglian cow

Registered: 15/07/04
Posts: 40
Is it possible to have an action set off at a specific time?

for example: ON TIME 14.20 /remove quotes.txt | /msg $chan updating quotes list.. PLease do not use !quote command for 10 minutes

so that at a specified time, itll remove the file quotes.txt and also at that time, msg a specified chan with the msg too?

Thanks.
_________________________
i script, therefore i am smirk
theres logic in there somewhere...

Top
#96379 - 01/09/04 11:39 AM Re: Timed action
dr_Eamer Offline
Vogon poet

Registered: 22/08/04
Posts: 101
Loc: Athens, Greece
From the mIRC 6.16 help file: (/help /timer)

/timer[N/name] [-ceomhipr] [color:red][time] <repetitions> <interval> <command>[/color]
Activates the specified timer to perform the specified command at a specified interval, and optionally at a specified time.

/timer9 14:30 1 1 /say It's now 2:30pm

This will wait until 2:30pm and will then announce the time once and stop.


I guess it solves your problem.
_________________________
Maybe I wake up one day to notice that all my life was just a dream!

Top
#96380 - 01/09/04 02:02 PM Re: Timed action
dmmrs Offline
Ameglian cow

Registered: 15/07/04
Posts: 40
Yeah I read that in the help file too.

Unfortunately though it doesn't solve my problem.

First of all, I have to physically type in the timer each time i start mIRC. Secondly, even if I do that, i can only run one command. Een if I put in a seperator, the /remove quotes.txt command runs at the specified time, granted. However, the second command in the list will run as soon as I start the timer.

I want the commands:

/remove quotes.txt
/msg # the quotes list is being updated, please wait.

To run at a specified time each and every day, for example 13:30

Then, 10 minutes later after that command runs,

/msg # the list has now been updated.

I don't really want to have to type /timer2 blah blah

Every time i restart mIRC.
_________________________
i script, therefore i am smirk
theres logic in there somewhere...

Top
#96381 - 01/09/04 02:22 PM Re: Timed action
dr_Eamer Offline
Vogon poet

Registered: 22/08/04
Posts: 101
Loc: Athens, Greece
Use on *:START:{ timer blah blah }
so that mIRC automatically sets the timer for you whenever you open mIRC. (although I'd suggest doing that on CONNECT because your script contains a msg command that can only be performed when you are connected)

Then if you want the timer to execute multiple commands there are two solutions:
a)Using an alias for the commands, then have the timer call the alias:
timer 13:30 1 0 blah

alias blah {
command1
command2
remove
do_whatever
}


b)Use the $() identifier around the pipe:
timer 13:30 1 0 blah $(|) command $(|) remove $(|) do_whatever

Edit: Minor grammatical error...


Edited by dr_Eamer (01/09/04 02:37 PM)
_________________________
Maybe I wake up one day to notice that all my life was just a dream!

Top
#96382 - 01/09/04 03:06 PM Re: Timed action
dmmrs Offline
Ameglian cow

Registered: 15/07/04
Posts: 40
ok that works fine now.

one more question?

timerupdate 14:30 1 0

i dont really understand the meaning of the 1 and the 0 . The help file was a bit vague about it.

It's on a connect command now, with the two timers at 1 0.

Does this now mean they will repeat at 14:30 each day from now on?
_________________________
i script, therefore i am smirk
theres logic in there somewhere...

Top
#96383 - 01/09/04 06:39 PM Re: Timed action
dr_Eamer Offline
Vogon poet

Registered: 22/08/04
Posts: 101
Loc: Athens, Greece
Ok here goes:
The parameters next to the time are the same parameters you would put to any timer.
When setting a

timer 14:30 M N command

it will cause the command to be executed at 14:30, M times, with N seconds interval.
It is like standing over your computer and your clock and when the time goes 14:30 you launch a " timer M N command ".

So the timer I gave you will execute the commands one (1) time and with no (0) interval (immediately).

This is not the way to make the command execute every day at the same time!
" timer 14:30 0 1 command " would execute the command after 14:30 every second, forever!
You have to reset the timer again to accomplish what you want.

Edit: Of course I suppose you'd want the timer to trigger without having to reconnect... I mean if you reconnect during the day, the timer will be reset by the on CONNECT event.

Please consult this thread for more on this!

Feel free to ask for more!


Edited by dr_Eamer (01/09/04 06:43 PM)
_________________________
Maybe I wake up one day to notice that all my life was just a dream!

Top
#96384 - 02/09/04 08:52 AM Re: Timed action
Iori Offline
Hoopy frood

Registered: 30/08/03
Posts: 1831
on *:connect:{
  • [color:green] ; If timer is not already activated, set it from the on connect event to run an alias
    if !$timer(dostuff) { .timerdostuff -i 14.20 dostuff }
}
alias -l dostuff {
  • .remove quotes.txt
    if $me ison #channel {
    msg $v2 updating quotes list.. PLease do not use !quote command for 10 minutes

    ; It may be an idea to have the !quote event in a #group and here you could /disable the group.

    }
    ; Re-set the timer to perform the second command(s) when upload is complete
    ; this time using -o switch (offline) so a possible disconnect won't unset it.

    .timerdostuff -o 1 600 domore
}
alias -l domore {
  • if $me ison #channel {
    msg $v2 the list has now been updated.

    ; If you used the #group, here you would /enable it again.

    }
    ; Now set the timer to repeat the cycle, no need for the o switch this time.
    .timerdostuff 14:20 1 0 dostuff
}[/color]

Top
#96385 - 03/09/04 10:04 AM Re: Timed action
Iori Offline
Hoopy frood

Registered: 30/08/03
Posts: 1831
Of course the command in the connect event should be
  • if !$timer(dostuff) { .timerdostuff -i 14.20 1 0 dostuff }
blush

Top