type /gone to turn on script
type /here to turn off script
enjoy simple and effective.
alias gone {
set %away 1
set %time $ctime
set %reason $1-
set %nick $me
/nick $me $+ `afk
/ame 9Has gone afk Reason: $1-
/away $1-
}
alias here {
set %away 2
/nick %nick
/ame 9Is Back left: $duration($calc($ctime - %time )) Reason: %reason
/away
}
on *:TEXT:*:#:{ if (%away = 1) && ($me isin $1-) {
set -u10 %h 1
.msg # 9is currently away Reason: %reason Time: $duration($calc($ctime - %time ))
}
elseif (%away = 1) && (%nick isin $1-) {
.msg # 9is currently away Reason: %reason Time: $duration($calc($ctime - %time ))
}
elseif (%h !== $null) {
halt
}
}
alias gone {
if ($right($me,4) != `afk) { tnick $me $+ `afk }
ame has gone afk Reason: $$1-
away $1-
}
alias here {
if ($away) {
if ($right($me,4) == `afk) { tnick $left($me,-4) }
ame is back after: $duration($awaytime) Reason: $awaymsg
away
}
}
on *:TEXT:*:#:{
if (($me isin $1-) || ($mnick isin $1-)) && ($away) && (!%floodnot) {
inc -u9 %floodnot
describe # is currently away Reason: $awaymsg Time: $duration($awaytime)
}
}
Master-Of-Death, did you test your script's flood protection? By the look of it, you'll still get flooded. The reason being that the %h variable is set every time when your name is called, and your second elseif statement is redundant. If I were you, my approach would be:
on *:TEXT:*:#:{ if (%h) { halt }
elseif ($me isin $1-) && (%away = 1) {
inc -u10 %h
.msg # 9is currently away Reason: %reason Time: $duration($calc($ctime - %time ))
}
}