Hi,
I've got this 'duration' script, which tells me how many months me and my boyfriend are together. But I've got a small issue.
I've edited it so it would put a , after each time thing (hour, minute, second etc.). So that would be: blablabla 3 hours, 25 minutes, 23 seconds.
But the problem is, it'll only add a , when the duration is more than 1 (> 1). When it's less than 1, or equal to 1, it wont add a , and I can't get this fixed.
alias richloe {
var %richloe = $dur($calc($ctime - $ctime(%richloe)))
msg $chan ricoenchloƫ
msg $chan They are together for %richloe $+ . Isn't that amazing!?
}
alias -l dur { %a = $1 | return $iif(!%a,0secs,$s(31536000, $chr(32) year) $s(2628000.0288, $chr(32) month) $s(604800, $chr(32) week) $s(86400, $chr(32) day) $s(3600, $chr(32) hour) $s(60, $chr(32) minute) $s(1, $chr(32) second)) }
alias -l s {
%b = $int($calc(%a /$1))
%a = %a % $1
if (%b && %c) {
return %b $+ $2 $+ $iif(%b > 1,s $+ $chr(44) $+ )
}
}
The variable %richloe has been set as: %richloe April 16 2010 13:11:00
Also, after 'minutes' it should add a 'and' in stead of a , (so, 22 hours, 23 minutes AND 45 seconds)
Any help?