/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
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