mIRC Home    About    Download    Register    News    Help

Print Thread
#63227 07/12/03 11:06 AM
Joined: Feb 2003
Posts: 2,812
Raccoon Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
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


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
#63228 11/12/03 05:23 PM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
I'd like /inc,/dec to respect leading zeros where applicable.
e.g ..
//var %var = 00 | inc %var
%var = 01

#63229 11/12/03 05:45 PM
Joined: Feb 2003
Posts: 2,812
Raccoon Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
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*


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
#63230 11/12/03 05:56 PM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Yes, indeed. laugh

#63231 13/12/03 02:13 PM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
I like the suggestion too, I've needed this many times and $base() is getting boring wink


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
#63232 13/12/03 03:38 PM
Joined: Feb 2003
Posts: 2,812
Raccoon Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
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


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
#63233 13/12/03 05:42 PM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Very good idea!


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com

Link Copied to Clipboard