From WikiChip
Difference between revisions of "mirc/commands/timer"
< mirc‎ | commands

(Switches)
m (Bot: de-linking old mIRC menu)
Line 1: Line 1:
{{mirc title|/timer Command}}{{mIRC menu}}
+
{{mirc title|/timer Command}}
 
The '''/timer command''' can be used to create a general purpose timer. A [[timer]] is a way to execute code at some specific interval or time and delay. [[Timers]] can be named and unnamed. Unnamed timers will get the lowest numeric timer index available. Named timers are specifically useful if you need to recall that timer at a later period - to pause it, resume it, or simply reset it. Starting a timer with a name that already exists will override the old timer. Timers only get execute on the main mIRC message loop. I.E. after the alias/event are complete.  
 
The '''/timer command''' can be used to create a general purpose timer. A [[timer]] is a way to execute code at some specific interval or time and delay. [[Timers]] can be named and unnamed. Unnamed timers will get the lowest numeric timer index available. Named timers are specifically useful if you need to recall that timer at a later period - to pause it, resume it, or simply reset it. Starting a timer with a name that already exists will override the old timer. Timers only get execute on the main mIRC message loop. I.E. after the alias/event are complete.  
  

Revision as of 18:43, 15 June 2017

The /timer command can be used to create a general purpose timer. A timer is a way to execute code at some specific interval or time and delay. Timers can be named and unnamed. Unnamed timers will get the lowest numeric timer index available. Named timers are specifically useful if you need to recall that timer at a later period - to pause it, resume it, or simply reset it. Starting a timer with a name that already exists will override the old timer. Timers only get execute on the main mIRC message loop. I.E. after the alias/event are complete.

Synopsis

/timers [off]
/timer[n|name] [off]
/timer[n|name] [-cdeomhiprzN] [time] <repetitions> <interval> <code>

Switches

Creation Manipulators

  • -o - Creates a offline timer
  • -c - Creates a catch-up timer
  • -h - Creates a high-resolution timer (interval is in millisecond just like -m)

Attributes

  • -m - Treats the interval parameter as milliseconds instead of seconds
  • -d - Keeps the order of all -d timers
  • -i - Dynamically associates itself with the active connection

Manipulator

  • -e - Executes the code associated with a timer
  • -p - Pauses a timer
  • -r - Resumes a timer
  • -zN - Resets an online timer; N=2 resets total time, N=1, resets current time, and N=0 is the same as N=1 AND N=2

Parameters

  • [off] - A literal 'off' keyword, used to turn off a timer.
  • [n|name] - The name or index of the timer
  • [time] - Time to activate the timer, for example '15:30' for 3:30PM
  • <repetitions> - The amount of times the timer should repeat itself. A repetition value of '0' will repeat for ever.
  • <interval> - The delay between two consecutive timer executions
  • <code> - Code to be executed.

Example

Below is a simple count down timer that uses a call-back alias once per second:

alias example {
  ; start cou
  var %reps = 5
 
  ; call the timer %reps times after 1 second delay each
  .timer %reps 1 count-down
 
  ; print the first count
  count-down
}
alias -l count-down {
  echo -a Count: $timer($ltimer).reps
}

The above code will generate the following output:

Count: 5
Count: 4
Count: 3
Count: 2
Count: 1
Count: 0

A more basic example of a message being delayed for 3 seconds:

on *:text:!foo:#foo:{
  ; delay the message for 3 seconds
  timer 1 3 msg #foo Bar!
}

A repetition of '0' can also be used to mean an repeat for ever:

alias cur_time {
  timer 0 1 echo -s $!time(hh:nn:ss)
}

Compatibility

Added: mIRC 3.3, 3.4

See also

v · d · e mIRC commands list

A /abook, /action, /add, /ajinvite, /alias, /aline, /ame, /amsg, /anick, /aop, /auser, /auto, /autojoin, /avoice, /away

B /background, /ban, /bcopy, /beep, /bindip, /bread, /break, /breplace, /bset, /btrunc, /bunset, /bwrite

C /channel, /clear, /clearall, /clearial, /cline, /clipboard, /close, /closechats, /closedccs, /closefserves, /closemsg, /cnick, /color, /colour, /comclose, /comlist, /commands, /comopen, /comreg, /continue, /copy, /creq, /ctcp, /ctcpreply, /ctcps

D /dcc, /dccserver, /dde, /ddeserver, /debug, /dec, /describe, /dialog, /did, /didtok, /disable, /disconnect, /dlevel, /dline, /dll, Template:mIRC/donotdisturb, /dns, /dqwindow, /drawcopy, /drawdot, /drawfill, /drawline, /drawpic, /drawrect, /drawreplace, /drawrot, /drawsave, /drawscroll, /drawsize /drawtext

E /ebeeps, /echo, /editbox, /else, /elseif, /emailaddr, /enable, /events, /exit

F /fclose, /filter, /findtext, /finger, /firewall, /flash, /flist, /flood, /flush, /flushini, /fnord, /font, /fopen, /fseek, /fsend, /fserve, /fullname, /fupdate, /fwrite

G /ghide, /gload, /gmove, /gopts, /goto, /gplay, /gpoint, /gqreq, /groups, /gshow, /gsize, /gstop, /gtalk, /gunload, /guser

H /hadd, /halt, /haltdef, /hdec, /hdel, /help, /hfree, /hinc, /hload, /hmake, /hotlink, /hop, /hsave

I /ial, /ialclear, /ialmark, /identd, /if, /ignore, /iline, /inc, /iuser

J /join

L /leave, /linesep, /links, /list, /load, /loadbuf, /localinfo, /log, /logview

M /maxdepth, /mdi, /me, /menubar, /mkdir, /mnick, /mode, /msg

N /noop, /notice, /notify

O /onotice, /omsg

P /pareline, /part, /partall, /pdcc, /perform, /play, /playctrl, /pop, /protect, /proxy, /pvoice

Q /qme, /qmsg, /query, /queryrn, /quit, /quote

R /raw, /registration, /reload, /remini, /remote, /remove, /rename, /renwin, /reseterror, /resetidle, /return, /returnex, /rlevel, /rline, /rmdir, /run, /ruser

S /save, /savebuf, /saveini, /say, /scid, /scon, /server, /set, /setlayer, /showmirc, /signal, /sline, /sockaccept, /sockclose, /socklist, /socklisten, /sockmark, /sockopen, /sockpause, /sockread, /sockrename, /sockudp, /sockwrite, /sound, /speak, /splay, /sreq, /strip, /switchbar

T /timer, /timestamp, /tip, /tips, /titlebar, /tnick, /tokenize, /toolbar, /topic /tray, /treebar

U /ulist, /unload, /unset, /unsetall, /updatenl, /url, /username, /uwho

V /var, /vcadd, /vcmd, /vcrem, /vol

W

X /xyzzy