on *:start: {
hmake AwayTable 50
}
on *:text:!afk*:#Simons-Forums: {
var %time = $ctime
if (!$hget(AwayTable)) { hmake AwayTable 50 }
if ($left($2,2) == -t) {
if ($len($2) == 2) {
var %reason = $iif($4,$4-,Unknown)
.timerAway. $+ $nick 1 $calc($3 * 3600) msg $chan $nick should be back soon.
}
else {
var %reason = $iif($3,$3-,Unknown)
.timerAway. $+ $nick 1 $calc($right($2,-2) * 3600) msg $chan $nick should be back soon.
}
}
else var %reason = $iif($2,$2-,Unknown)
hadd AwayTable $nick %reason %time
msg $chan $nick is away @ $+ $time(%time,hh:nn mmm dd yyyy)
}
on *:text:!back:#Simons-Forums: {
if ($hget(AwayTable,$nick)) {
msg $chan $nick is back from $gettok($v1,1- $calc($gettok($v1,0,32) - 1),32) $+ . $nick was gone for $duration($calc($ctime - $gettok($v1,$gettok($v1,0,32),32))) $+ .
hdel AwayTable $nick
.timerAway. [ $+ [ $nick ] ] off
}
else msg $chan You're not away.
}
on *:text:!away:#Simons-Forums: {
var %cnt = 1
var %total = $hget(AwayTable,0).item
while (%cnt <= %total) {
var %name = $hget(AwayTable,%cnt).item
var %data = $hget(AwayTable,%cnt).data
write afk.tmp %name is away $chr(40) $+ $gettok(%data,1- $calc($gettok(%data,0,32) -1),32) $+ $chr(41) since $time on $date($gettok(%data,$gettok(%data,0,32),32)) $+ .
inc %cnt
}
.play $chan afk.tmp 1500
.remove afk.tmp
}
on *:text:*:#Simons-Forums: {
if ($hget(AwayTable,$remove($strip($1),?)) && !$2) {
var %data = $hget(AwayTable,$remove($strip($1),?))
msg $chan $remove($strip($1),?) is away $chr(40) $+ $gettok(%data,1- $calc($gettok(%data,0,32) -1),32) $+ $chr(41) since $time($gettok(%data,$gettok(%data,0,32),32)) $+ .
}
}
on *:action:*:#Simons-Forums: {
if ($hget(AwayTable,$remove($strip($1),?)) && !$2) {
var %data = $hget(AwayTable,$remove($strip($1),?))
msg $chan $left($1,-1) is away $chr(40) $+ $gettok(%data,1- $calc($gettok(%data,0,32) -1),32) $+ $chr(41) since $time($gettok(%data,$gettok(%data,0,32),32)) on $date($gettok(%data,$gettok(%data,0,32),32)) $+ .
}
}
on *:part:#Simons-Forums: {
if ($hget(AwayTable,$nick)) {
hdel AwayTable $nick
.timerAway. [ $+ [ $nick ] ] off
}
}
on *:quit: {
if ($hget(AwayTable,$nick)) {
hdel AwayTable $nick
.timerAway. [ $+ [ $nick ] ] off
}
}