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

m (bot: sort-key added to category)
(Synopsis)
 
(11 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{mIRC menu}}
+
{{mirc title|/inc Command}}
The '''/inc command''' increases the value of a variable by a given value. If no value is specified, mIRC will increase the variable by one. The /inc command works with both positive and negative values alike.
+
The '''/inc command''' increases the numeric value of a variable by a given value. If [value] is not specified, mIRC will increase the variable by one. The /inc command works with both positive and negative values alike.
 +
 
 +
'''Note''': /inc always keeps the unset time if there is one for the current variable, as though there was a -k switch from {{mIRC|/set}}, there's no switch to prevent this behavior and unset the time while setting the value.
  
 
== Synopsis ==
 
== Synopsis ==
  /inc [-sczeuN] <%var> [value]
+
  /inc [-scrzeuN] <%var> [value]
  
 
== Switches ==
 
== Switches ==
* '''-c''' - Increases the variable once per second
 
 
* '''-s''' - Prints out the value of the variable  
 
* '''-s''' - Prints out the value of the variable  
* '''-z''' - Increases the variable every second until it reaches zero at which point the variable will get removed.  
+
Global variables only:
 +
* '''-c''' - Increases the variable by 1 every second
 +
* '''-r''' - Increases the variable by 1 every second (same as -c)
 +
* '''-z''' - Decreases the variable by 1 every second until it reaches zero at which point the variable will get unset.  
 
* '''-e''' - Unsets the variable when mIRC exits  
 
* '''-e''' - Unsets the variable when mIRC exits  
* '''-uN''' - Increases the variable once and unsets the variable after N seconds.
+
* '''-uN''' - Increases the variable once and unsets the variable after N seconds
  
 
== Parameters ==
 
== Parameters ==
 
* '''%var''' - The variable's name  
 
* '''%var''' - The variable's name  
* '''[value]''' - Optional numeric value to increase the variable by
+
* '''[value]''' - Optional numeric value to increase the variable by. Default is 1 if [value] not used
  
 
== Example ==
 
== Example ==
Line 26: Line 30:
 
}</syntaxhighlight>
 
}</syntaxhighlight>
  
 +
<source lang="mIRC">
 +
Note: if script or timer execution lasts longer than 1 second, -c and -z can skip increments or decrements:
 +
//set %i 10 | inc -z %i | timertest 5 1 echo -a $!timer(test).reps $!asctime i= $eval(%i,0) $(|) var $eval(%j,0) 99999 $(|) while ( $eval(%j,0) ) $chr(123) var $eval(%k,0) $!rand(1,999) $(|) dec $eval(%j,0) $chr(125) | echo -a com: $timer(test).com | timer
 +
 +
//var %i 1 | inc %i 0 | echo -a this did not change i= %i | var %j $null | inc %i | echo -a this changed by 1 because [value] is null i= %i
 +
  this did not change i= 1
 +
  this changed by 1 because [value] is null i= 2
 +
  this incremented by 3 i= 5
 +
 +
//var %i foo | inc %i | inc %i 5 | echo -a inc does not alter non-numeric values i= %i
 +
</source>
 
== Compatibility ==
 
== Compatibility ==
 
{{mIRC compatibility|4.0}}
 
{{mIRC compatibility|4.0}}
 
 
== See also ==
 
== See also ==
 
* [[List of commands - mIRC|List of commands]]
 
* [[List of commands - mIRC|List of commands]]
Line 39: Line 53:
 
* {{mIRC|/var}}
 
* {{mIRC|/var}}
 
{{mIRC command list}}
 
{{mIRC command list}}
 
 
[[Category:mIRC commands|inc command - mIRC]]
 
[[Category:mIRC commands|inc command - mIRC]]

Latest revision as of 16:03, 17 February 2022

The /inc command increases the numeric value of a variable by a given value. If [value] is not specified, mIRC will increase the variable by one. The /inc command works with both positive and negative values alike.

Note: /inc always keeps the unset time if there is one for the current variable, as though there was a -k switch from /set, there's no switch to prevent this behavior and unset the time while setting the value.

Synopsis[edit]

/inc [-scrzeuN] <%var> [value]

Switches[edit]

  • -s - Prints out the value of the variable

Global variables only:

  • -c - Increases the variable by 1 every second
  • -r - Increases the variable by 1 every second (same as -c)
  • -z - Decreases the variable by 1 every second until it reaches zero at which point the variable will get unset.
  • -e - Unsets the variable when mIRC exits
  • -uN - Increases the variable once and unsets the variable after N seconds

Parameters[edit]

  • %var - The variable's name
  • [value] - Optional numeric value to increase the variable by. Default is 1 if [value] not used

Example[edit]

Alias Example {
  ;Create a local variable and set it to 5
  var %x 5
  ;Increase %x by 5 
  inc %x 5
  ;Print out %x's content
  echo -a %x
}
Note: if script or timer execution lasts longer than 1 second, -c and -z can skip increments or decrements:
//set %i 10 | inc -z %i | timertest 5 1 echo -a $!timer(test).reps $!asctime i= $eval(%i,0) $(|) var $eval(%j,0) 99999 $(|) while ( $eval(%j,0) ) $chr(123) var $eval(%k,0) $!rand(1,999) $(|) dec $eval(%j,0) $chr(125) | echo -a com: $timer(test).com | timer
 
//var %i 1 | inc %i 0 | echo -a this did not change i= %i | var %j $null | inc %i | echo -a this changed by 1 because [value] is null i= %i
  this did not change i= 1
  this changed by 1 because [value] is null i= 2
  this incremented by 3 i= 5
 
//var %i foo | inc %i | inc %i 5 | echo -a inc does not alter non-numeric values i= %i

Compatibility[edit]

Added: mIRC v4.0
Added on: 20 Mar 1996
Note: Unless otherwise stated, this was the date of original functionality.
Further enhancements may have been made in later versions.

See also[edit]

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