on *:start:{
if ($isfile(away.hsh)) {
hmake away 5
hload -o away away.hsh
}
else {
hmake away 5
hadd away $+($date,$time) away
}
if ($isfile(back.hsh)) {
hmake back 5
hload -o back back.hsh
}
else {
hmake back 5
hadd back $+($date,$time) back
}
if ($isfile(suffix.hsh)) {
hmake suffix 5
hload -o suffix suffix.hsh
}
else {
hmake suffix 5
hadd suffix $+($date,$time) away
}
if (%as6cooldown == $null) {
set %as6cooldown 160
}
if (%as6awaymessage == $null) {
set %as6awaymessage away
}
if (%as6backmessage == $null) {
set %as6backmessage back
}
if (%as6awaysuffix == $null) {
set %as6awaysuffix away
}
}
on *:unload:{
if ($isfile(away.hsh)) {
remove away.hsh
}
if ($isfile(back.hsh)) {
remove back.hsh
}
if ($isfile(suffix.hsh)) {
remove suffix.hsh
}
var %unloadas6 = 1
var %unloadas62 = $scon(0)
while (%unloadas6 <= %unloadas62) {
scon %unloadas6 away.off
inc %unloadas6
}
autoaway.off
autoback.off
unset %as6*
hfree away
hfree back
hfree suffix
}
on *:exit: {
hsave -o away " $+ $scriptdiraway.hsh"
hfree away
hsave -o back " $+ $scriptdirback.hsh"
hfree back
hsave -o suffix " $+ $scriptdirsuffix.hsh"
hfree suffix
}
menu channel {
Away Script
.away
..on {
away.on
}
..off {
away.off
}
.control center {
dialog -m as as
}
}
#away.aliases on
alias away.off {
if ($($+(%,as6,$network,away),2) != off) {
nick $mnick
set $+(%,as6,$network,away) off
echo 5 -a Away is off.
set %as6chan 1
set %as6cnum $chan(0)
while (%as6chan <= %as6cnum) {
notice $chan(%as6chan) $mnick is %as6backmessage
inc %as6chan
}
}
else {
echo 5 -a Away is already off.
}
}
alias away.on {
if ($($+(%,as6,$network,away),2) != on) {
tnick $me $+ - $+ %as6awaysuffix
set $+(%,as6,$network,away) on
echo 5 -a Away is on.
set %as6chan 1
set %as6cnum $chan(0)
while (%as6chan <= %as6cnum) {
.timer 1 1 notice $chan(%as6chan) $mnick is %as6awaymessage $+ ; to page me type !page $!me
inc %as6chan
}
}
else {
echo 5 -a Away is already on.
}
}
alias autoback.on {
if ($group(#autoback) != on) {
.enable #autoback
echo 5 -a Auto back is on
}
else {
echo 5 -a Auto back is already on
}
}
alias autoback.off {
if ($group(#autoback) != off) {
.disable #autoback
echo 5 -a Auto back is off
}
else {
echo 5 -a Auto back is already off
}
}
alias autoaway.on {
if ($timer(away) == $null) {
.timeraway 0 10 away.idle
echo 5 -a Auto away is now on.
}
else {
echo 5 -a Auto away is already on.
}
}
alias autoaway.off {
if ($timer(away) != $null) {
set %as6timeraway off
.timeraway off
echo 5 -a Auto away is now off
}
else {
echo 5 -a Auto away is already off.
}
}
alias away.idle {
var %unloadas6 = 1
var %unloadas62 = $scon(0)
while (%unloadas6 <= %unloadas62) {
scon %unloadas6
if (($idle >= 600) && ($($+(%,as6,$network,away),2) != on)) {
away.on
}
inc %unloadas6
}
}
alias pager.on {
if (%as6pagetimer == on) {
unset %as6pagetimer
echo 5 -a Pager has been turned on.
}
else {
echo 5 -a Pager is already on
}
}
alias pager.off {
if (%as6pagetimer != on) {
set %as6pagetimer on
echo 5 -a Pager has been turned off
}
else {
echo 5 -a Pager is already off.
}
}
#away.aliases end
#away on
on *:Connect: {
if (%as6timeraway != off) {
.timeraway 0 10 away.idle
}
}
on *:text:*:?:{
if (($($+(%,as6,$network,away),2) == on) && (%as6awaymsgtimer != on)) {
msg $nick 4,1 Sorry $nick $+ ; I am %as6awaymessage $+ ; to page me type !page $me
set -u10 %as6awaymsgtimer on
}
}
on *:text:!page &:#:{
if ((($($+(%,as6,$network,away),2) == on) && (%as6pagetimer != on) && ($$2 == $me))) {
.timer 5 1 beep
set $+(-u,$(%as6cooldown)) %as6pagetimer on
echo 5 -a $nick paged you!
msg $chan 11,1 $nick has paged me, the pager wont be available for $calc($(%as6cooldown)/60) minutes.
}
}
#away end
#autoback on
on *:input:*:{
if ($($+(%,as6,$network,away),2) == on) {
away.off
}
}
#autoback end
dialog AS {
title "Away Script by TrusTkill"
size -1 -1 236 370
button "Ok", 1, 28 345 90 25, ok
button "Cancel", 2, 118 345 90 25, cancel
text "Main", 3, 10 40 60 15
radio "on", 4, 10 55 30 15, group
radio "off", 5, 10 70 30 15
text "Auto Back", 6, 0 95 60 15
radio "on", 7, 10 110 30 15, group
radio "off", 8, 10 125 30 15
text "Auto Away", 9, 0 150 60 15
radio "on", 10, 10 165 30 15, group
radio "off", 11, 10 180 30 15
text "Pager", 12, 10 205 60 15
radio "on", 13, 10 220 30 15, group
radio "off", 14, 10 235 30 15
box "", 15, 0 45 50 45
box "", 16, 0 100 50 45
box "", 17, 0 155 50 45
box "", 18, 0 210 50 93
text "Add Away Mess.", 19, 60 0 100 25
button "Add", 20, 55 15 90 25
text "Select Away Message", 21, 95 40 130 15
list 22, 55 55 180 80
text "Add Back Mess.", 23, 60 115 100 25
button "Add", 24, 55 130 90 25
text "Select Back Message", 25, 95 155 130 15
list 26, 55 170 180 80
text "Del Away Mess.", 27, 155 0 100 25
button "Delete", 28, 145 15 90 25
text "Del Back Mess.", 29, 155 115 100 25
button "Delete", 30, 145 130 90 25
text "Add Suffix", 31, 60 230 100 25
button "Add", 32, 55 245 90 25
text "Del Suffix", 33, 155 230 100 25
button "Delete", 34, 145 245 90 25
text "Select Nick Suffix", 35, 95 270 100 25
list 36, 55 285 180 80
text "Cooldown", 37, 1 255 50 15
edit "", 38, 1 270 47 15
text "Seconds", 39, 5 285 50 15
}
dialog AA {
title "Add Away Message"
size -1 -1 150 75
button "Ok", 1, 5 40 70 25, ok
button "Cancel", 2, 75 40 70 25, cancel
text "New Away Message", 3, 27 0 130 15
edit "", 4, 5 15 140 20
}
dialog AB {
title "Add Back Message"
size -1 -1 150 75
button "Ok", 1, 5 40 70 25, ok
button "Cancel", 2, 75 40 70 25, cancel
text "New Back Message", 3, 27 0 130 15
edit "", 4, 5 15 140 20
}
dialog DA {
title "Delete Away Message"
size -1 -1 190 105
button "Ok", 1, 5 75 90 25, ok
button "Cancel", 2, 95 75 90 25, cancel
text "Select Message to Delete", 3, 40 0 130 15
list 4, 5 15 180 80
}
dialog DB {
title "Delete Back Message"
size -1 -1 190 105
button "Ok", 1, 5 75 90 25, ok
button "Cancel", 2, 95 75 90 25, cancel
text "Select Message to Delete", 3, 40 0 130 15
list 4, 5 15 180 80
}
dialog AAS {
title "Add Away Suffix"
size -1 -1 150 75
button "Ok", 1, 5 40 70 25, ok
button "Cancel", 2, 75 40 70 25, cancel
text "New Away Suffix", 3, 27 0 130 15
edit "", 4, 5 15 140 20
}
dialog DAS {
title "Delete Away Suffix"
size -1 -1 190 105
button "Ok", 1, 5 75 90 25, ok
button "Cancel", 2, 95 75 90 25, cancel
text "Select Suffix to Delete", 3, 40 0 130 15
list 4, 5 15 180 80
}
on *:dialog:as:init:*:{
set %as6awyn 1
while ($hget(away,%as6awyn).item != $null) {
did -a as 22 $hget(away,%as6awyn).data
inc %as6awyn
}
set %as6bwyn 1
while ($hget(back,%as6bwyn).item != $null) {
did -a as 26 $hget(back,%as6bwyn).data
inc %as6bwyn
}
set %as6swyn 1
while ($hget(suffix,%as6swyn).item != $null) {
did -a as 36 $hget(suffix,%as6swyn).data
inc %as6swyn
}
if ($($+(%,as6,$network,away),2) == on) {
did -c as 4
}
if ($($+(%,as6,$network,away),2) != on) {
did -c as 5
}
if ($group(#autoback) == on) {
did -c as 7
}
if ($group(#autoback) == off) {
did -c as 8
}
if ($timer(away) != $null) {
did -c as 10
}
if ($timer(away) == $null) {
did -c as 11
}
if (%as6pagetimer == $null) {
did -c as 13
}
if (%as6pagetimer == on) {
did -c as 14
}
if (%as6cooldown != $null) {
did -a as 38 %as6cooldown
}
}
on *:dialog:da:init:*:{
set %as6awyn 1
while ($hget(away,%as6awyn).item != $null) {
did -a da 4 $hget(away,%as6awyn).data
inc %as6awyn
}
}
on *:dialog:db:init:*:{
set %as6bwyn 1
while ($hget(back,%as6bwyn).item != $null) {
did -a db 4 $hget(back,%as6bwyn).data
inc %as6bwyn
}
}
on *:dialog:das:init:*:{
set %as6swyn 1
while ($hget(suffix,%as6swyn).item != $null) {
did -a das 4 $hget(suffix,%as6swyn).data
inc %as6swyn
}
}
on *:dialog:as:sclick:20:{
dialog -c as as
dialog -m aa aa
}
on *:dialog:as:sclick:24:{
dialog -c as as
dialog -m ab ab
}
on *:dialog:as:sclick:28:{
dialog -c as as
dialog -m da da
}
on *:dialog:as:sclick:30:{
dialog -c as as
dialog -m db db
}
on *:dialog:as:sclick:32:{
dialog -c as as
dialog -m aas aas
}
on *:dialog:as:sclick:34:{
dialog -c as as
dialog -m das das
}
on *:dialog:aa:sclick:1:{
if (($did(aa,4).edited == $true) && ($hget(away))) {
hadd away $+($date,$time) $did(aa,4).text
hsave -o away " $+ $scriptdiraway.hsh"
dialog -m as as
}
if (($did(aa,4).edited == $true) && ($hget(away) == $null)) {
hmake away 5
hadd away $+($date,$time) $did(aa,4).text
hsave -o away " $+ $scriptdiraway.hsh"
dialog -m as as
}
if ($did(aa,4).edited != $true) {
dialog -m as as
}
}
on *:dialog:ab:sclick:1:{
if (($did(ab,4).edited == $true) && ($hget(back))) {
hadd back $+($date,$time) $did(ab,4).text
hsave -o back " $+ $scriptdirback.hsh"
dialog -m as as
}
if (($did(ab,4).edited == $true) && ($hget(back) == $null)) {
hmake back 5
hadd back $+($date,$time) $did(ab,4).text
hsave -o back " $+ $scriptdirback.hsh"
dialog -m as as
}
if ($did(ab,4).edited != true) {
dialog -m as as
}
}
on *:dialog:da:sclick:1:{
if (($did(da,4).sel != $null) && ($hget(away))) {
hdel away $hfind(away,$did(da,4).seltext).data
hsave -o away " $+ $scriptdiraway.hsh"
dialog -m as as
}
else {
dialog -m as as
}
}
on *:dialog:db:sclick:1:{
if (($did(db,4).sel != $null) && ($hget(back))) {
hdel back $hfind(back,$did(db,4).seltext).data
hsave -o back " $+ $scriptdirback.hsh"
dialog -m as as
}
else {
dialog -m as as
}
}
on *:dialog:aas:sclick:1:{
if (($did(aas,4).edited == $true) && ($hget(suffix))) {
hadd suffix $+($date,$time) $did(aas,4).text
hsave -o suffix " $+ $scriptdirsuffix.hsh"
dialog -m as as
}
if (($did(aas,4).edited == $true) && ($hget(suffix) == $null)) {
hmake suffix 5
hadd suffix $+($date,$time) $did(aas,4).text
hsave -o suffix " $+ $scriptdirsuffix.hsh"
dialog -m as as
}
if ($did(aas,4).edited != $true) {
dialog -m as as
}
}
on *:dialog:das:sclick:1:{
if (($did(das,4).sel != $null) && ($hget(suffix))) {
hdel suffix $hfind(suffix,$did(das,4).seltext).data
hsave -o suffix " $+ $scriptdirsuffix.hsh"
dialog -m as as
}
else {
dialog -m as as
}
}
on *:dialog:as:sclick:1:{
if ($did(as,22).seltext != $null) {
set %as6awaymessage $did(as,22).seltext
}
if ($did(as,26).seltext != $null) {
set %as6backmessage $did(as,26).seltext
}
if ($did(as,36).seltext != $null) {
set %as6awaysuffix $did(as,36).seltext
}
if ($did(as,7).state == 1) {
autoback.on
}
if ($did(as,8).state == 1) {
autoback.off
}
if ($did(as,10).state == 1) {
autoaway.on
}
if ($did(as,11).state == 1) {
autoaway.off
}
if ($did(as,13).state == 1) {
pager.on
}
if ($did(as,14).state == 1) {
pager.off
}
if ($did(as,4).state == 1) {
away.on
}
if ($did(as,5).state == 1) {
away.off
}
if ($did(as,38).edited == $true) {
set %as6cooldown $did(as,38).text
}
}