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

(Created page with "The '''/write command''' is a construct in the mIRC scripting language that can perform repetitive operations. The block of statement inside the while l...")
 
m (Bot: Adding a template)
Line 94: Line 94:
 
* [[/return command - mIRC|/return]]
 
* [[/return command - mIRC|/return]]
 
* [[/returnex command - mIRC|/returnex]]
 
* [[/returnex command - mIRC|/returnex]]
 +
{{mIRC command list}}
  
[[Category:mIRC commands]]
+
[[Category:MIRC commands]]

Revision as of 22:10, 3 July 2014

The /write command is a construct in the mIRC scripting language that can perform repetitive operations. The block of statement inside the while loop will get executed as long as the condition is true. You can manually break out of a loop by using the Cltr+Break key combinations.

Synopsis

while (condition) {
  /statements
  /statements
  /statements
}

Switches

None

Parameters

None

Example

/* Example 1
*/
Alias CountToTen {
  ;Create a counter variable, set it to one
  var %Counter = 1
 
  ;Loop while the counter variable is less than or equal to ten.
  while (%Counter <= 10) {
 
    ;Print out the value of the counter variable
    echo -a Count Number: %Counter
 
    ;Increase the counter variable by 1
    inc %Counter
  }
}

The above example will output:

Count Number: 1
Count Number: 2
Count Number: 3
Count Number: 4
Count Number: 5
Count Number: 6
Count Number: 7
Count Number: 8
Count Number: 9
Count Number: 10

Example 2:

/* Example 2
*/
 
Alias ListVars {
  ;Check if there are any variables set
  if (!$var(*,0)) {
    echo -a There Are No Variables.
    halt
  } 
 
  ;Set a counter variable
  var %a 1
 
  ;Loop while the counter variable is less than or equal to the total number of variables
  while (%a <= $var(*,0)) { 
 
    ;Print out the variable and its value
    echo -a $v1 $+ ) $var(*,$v1) = $var(*,$v1).value 
 
    ;Increase the variable by one
    inc %a
  }
}

The above example will output something like this:

1) %Foo = FooBar
2) %Bar = BarFoo

Compatibility

Added: mIRC v5.7

Added On: 02/02/2000


Note: Individual switches were not taken into consideration.

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