;Multimedia speed -z options for /SET
;
;usage: /SET -mNNNN,VVVV %var value
; -m (lower case ONLY, using uppercase well have undefined results)
; NNNN is number of milliseconds before next subtraction occurs (invalid values well default to 1000)
; VVVV is value to subtract (negitive values well be considered positive, invalid values (including zero) well default to 1)
;
; Example /SET -m100,2.5 %var 99.81 ( %var is set to 99.81 then every 10th of a second 2.5 is subtracted, untell the value falls below zero and the %var is unset )
; Example /SET -m1500,-1.4 %var 12.5x ( %var is set to 12.5x then every 1.5 seconds 1.4 is subtracted, first subtracted result well make %var 11.1 )
; Example /SET -m2000,3 %var x12.5 ( %var is set to x12.5 then in 2 seconds 3 is subtracted, first subtraction results in -3 and %var is unset )
; Example /SET -sm200,.001z %var 10 ( %var is set to 10 then every 5th of a seconds 0.001 is subtracted, when the second changes 1 is subtracted due to the -z option )
; ( NB: the -z option goes off as the second changes, not in 1 second from its inital setting, so there may or maynot be 5 -m200 events before it)
;
; NB: the -s & -n & -z options are functional.
; The -u option well function ONLY if the unset occurs BEFORE the first NNNN milliseconds, this essentially means it is disabled.
; This was becuase I was unable to locate a function or property ( similar to $hget(name/N, item).unset ) that could supply me the remaining time before an unset occurs.
;
#set_-m on
alias set {
if ((-*m* iswmcs $1) && ($3)) {
var %rate = $iif(($int($calc($mid($1,$calc($pos($1,m,1) + 1)) * 1)) isnum 1-),$v1,1000)
var %size = $iif(($abs($calc($mid($1,$calc($pos($1,$chr(44),1) + 1)) * 1)) > 0),$v1,1)
$+( .timer.set_-m.,$2 -mo 0 %rate $iif(!$show,.) $+ set $replacexcs($1,m,M) $2 %size )
$iif($isalias(set.dispatcher),set.dispatcher) $+( $iif(!$show,.) , set $1- )
}
elseif ((-*M* iswmcs $1) && ($2)) {
if ($calc($calc($eval($2,2) * 1) - $3) > 0) {
$iif($isalias(set.dispatcher),set.dispatcher) $+( $iif(!$show,.) , set $1 $2 [ $v1 ] )
}
else {
.timer.set_-m. $+ $2 off
$+( $iif(!$show,.) , unset $iif(($1 == -Ms),-s) $2 $3- )
}
}
else {
.timer.set_-m. $+ $iif((-* !iswm $1),$1,$2) off
$iif($isalias(set.dispatcher),set.dispatcher) $+( $iif(!$show,.) , set $1- )
}
}
;
; ** If you do not beleieve you well ever have another /SET alias installed then the remove the set.dispatcher alias
;
alias -l set.dispatcher {
.timer 1 0 .enable #set_-m
.disable #set_-m
$1-
.enable #set_-m
}
#set_-m end