mIRC Homepage
Posted By: Raccoon /inc %var N1 N2 N3 ... - 07/12/03 11:06 AM
I suppose I should have suggested this years and years ago, but it always slipped my mind.

Upgrade to the /inc command, allow multiple parameters to incriment space-delimited values. This will save much processor time instead of futzing around with $gettok $calc $puttok.

Examples:

/inc %var 1 1 [color:666666](example of /inc initializing %var)[/color]
%var = 1 1
/inc %var 0 1 [color:666666](example of /inc adding to the second value)[/color]
%var = 1 2
/inc %var 0 -1 3 0 [color:666666](example of /inc subtracting from the second, and adding 3rd and 4th values)[/color]
%var = 1 1 3 0
/inc -z %var 0 1 0 4 [color:666666](example of /inc -z decrimenting each value by one, per second.)[/color]
%var = 1 2 3 4
%var = 0 1 2 3
%var = 0 0 1 2
%var = 0 0 0 1
%var = (unset) [color:666666](Once all values reach zero, the variable is unset.)[/color]

All related uses of /inc and /dec and /hinc and /hdec should be adjusted accordingly.

(Edit:) Oh yes.. and if you use /inc with fewer values, it will truncate the omitted tokens from the end. This should remain simple, and tokens should NEVER be dropped from the middle.
When decrimenting, all 0 values will stay (even on the end) until EVERY token is 0.

- Raccoon
Posted By: Iori Re: /inc %var N1 N2 N3 ... - 11/12/03 05:23 PM
I'd like /inc,/dec to respect leading zeros where applicable.
e.g ..
//var %var = 00 | inc %var
%var = 01
Posted By: Raccoon Re: /inc %var N1 N2 N3 ... - 11/12/03 05:45 PM
Oh, that'd be nifty too!! And
/inc %var 01
allowing you to control the zero-padding there too.

Great for numbered lists, saving the trouble of having to
$iif(%i < 10,0) $+ %i  [or]  $base(%i,10,10,2) *ick*
Posted By: Iori Re: /inc %var N1 N2 N3 ... - 11/12/03 05:56 PM
Yes, indeed. laugh
Posted By: qwerty Re: /inc %var N1 N2 N3 ... - 13/12/03 02:13 PM
I like the suggestion too, I've needed this many times and $base() is getting boring wink
Posted By: Raccoon Re: /inc %var N1 N2 N3 ... - 13/12/03 03:38 PM
While Khaled is revaming /inc, I would also like to see it support multiple variables as /var does.
This would be especially handy in loops.

So, what we have are 3 suggestions...
[*] Multiple tokens in /inc
[*] Zero padding in /inc
[*] Multiple variables in /inc

/inc %var1 01 0 002 000, %var2 03 -03 100 -100
%var1 = 01 0 002 000
%var2 = 03 -03 100 -100


grin
Posted By: qwerty Re: /inc %var N1 N2 N3 ... - 13/12/03 05:42 PM
Very good idea!
© mIRC Discussion Forums