I got a bit bored so decided to make an away script for all the newbies on IRC.
It includes:
Away/Back channel notification - /away and /back, including time away.
Nickalert - to alert people that you are away when they say your nick (with a flood protection to stop you from /notice spamming people)
Awaylog - logs when people say your nick.
Version 3 now includes multi-network away, and channel exclusion.
Currently it has only tested on mIRC 6.35.
Please let me know of any problems with other versions of mIRC, and of any CONSTRUCTIVE criticism on this script.
Thank you.
Instructions:
###############################################
## Ame Alias ##
## ##
###############################################
alias ames {
if ($network == KingdomChat) {
var %chans = 1
;set %awayexclude as the channels excluded from custom /ame (separated by spaces)
var %awayexclude = #channel1 #channel2
while $chan(%chans) {
if ( !$istok( %awayexclude, $v1, 32) ) {
describe $chan(%chans) $1-
}
inc %chans
}
}
}
alias away {
set %multinetwork $scid(0)
while (%multinetwork != 0) {
scid $scon(%multinetwork)
if ($1- != $null) {
set %away.reason $1-
set %away.time $ctime
ames is now away: %away.reason 10<4H15-4A15-4Z15-7S15-7C15-7R15-7I15-7P15-7T10 13v3.010>
!away %away.reason
set %isaway 1
dec %multinetwork
}
if ($1- = $null) {
echo -a You need to provide a reason to set /away.
halt
}
}
}
alias back {
if (%isaway = 1) {
set %multinetwork $scid(0)
while (%multinetwork != 0) {
scid $scon(%multinetwork)
ames is back from: %away.reason (been away for $duration($calc($ctime - %away.time)) $+ ) 10<4H15-4A15-4Z15-7S15-7C15-7R15-7I15-7P15-7T10 13v3.010>
!away
dec %multinetwork
}
unset %nickalert.*
unset %away.*
unset %isaway
else {
echo -a You are not marked as away yet. Use /away <reason> to mark yourself as away.
}
}
}
on *:text:*:#: {
if ($me isin $1-) {
if (%isaway = 1) {
set %suffix $nick $+ . $+ $network
if ($window(@Awaylog) != $null) {
aline @Awaylog 4( $+ $time(HH:nn:sstt) $+ ) (4 $+ $nick $+ ) in 4 $+ # $+ said:13 $1-
}
else {
window -kns @Awaylog
aline @Awaylog 10<4H15-4A15-4Z15-7S15-7C15-7R15-7I15-7P15-7T10 13v3.010>
aline @Awaylog 4( $+ $time(HH:nn:sstt) $+ ) (4 $+ $nick $+ ) in 4 $+ # $+ said:13 $1-
}
if (%nickalert. [ $+ [ %suffix ] ] != $true) {
set -u3600 %nickalert. [ $+ [ %suffix ] ] $true
.notice $nick is away ( $+ %away.reason $+ ) (been away for $duration($calc($ctime - %away.time)) $+ ) 10<4H15-4A15-4Z15-7S15-7C15-7R15-7I15-7P15-7T10 13v3.010>
unset %suffix
}
}
}
}
on *:action:*:#: {
if ($me isin $1-) {
if (%isaway = 1) {
set %suffix $nick $+ . $+ $network
if ($window(@Awaylog) != $null) {
aline @Awaylog 4( $+ $time(HH:nn:sstt) $+ ) (4 $+ $nick $+ ) in 4 $+ # $+ did an action:13 $1-
}
else {
window -kns @Awaylog
aline @Awaylog 10<4H15-4A15-4Z15-7S15-7C15-7R15-7I15-7P15-7T10 13v3.010>
aline @Awaylog 4( $+ $time(HH:nn:sstt) $+ ) (4 $+ $nick $+ ) in 4 $+ # $+ did an action:13 $1-
}
if (%nickalert. [ $+ [ %suffix ] ] != $true) {
set -u3600 %nickalert. [ $+ [ %suffix ] ] $true
.notice $nick is away ( $+ %away.reason $+ ) (been away for $duration($calc($ctime - %away.time)) $+ ) 10<4H15-4A15-4Z15-7S15-7C15-7R15-7I15-7P15-7T10 13v3.010>
unset %suffix
}
}
}
}
on *:notice:*:*: {
if ($nick == $me) { halt }
if (%isaway == 1) {
set %suffix $nick $+ . $+ $network
if ($window(@Awaylog) != $null) {
aline @Awaylog 4( $+ $time(HH:nn:sstt) $+ ) (4 $+ $nick $+ ) $+ noticed you:13 $1-
}
else {
window -kns @Awaylog
aline @Awaylog 10<4H15-4A15-4Z15-7S15-7C15-7R15-7I15-7P15-7T10 13v3.010>
aline @Awaylog 4( $+ $time(HH:nn:sstt) $+ ) (4 $+ $nick $+ ) $+ noticed you:13 $1-
}
if (%nickalert. [ $+ [ %suffix ] ] != $true) {
set -u3600 %nickalert. [ $+ [ %suffix ] ] $true
.notice $nick is away ( $+ %away.reason $+ ) (been away for $duration($calc($ctime - %away.time)) $+ ) 10<4H15-4A15-4Z15-7S15-7C15-7R15-7I15-7P15-7T10 13v3.010>
unset %suffix
}
}
}
well first off you can take this part
alias away {
if ($1- != $null) {
set %away.reason $1-
set %away.time $ctime
ame is now away: %away.reason 10<4Haz7script10 13v2.010>
!away %away.reason
set %isaway 1
}
if ($1- = $null) {
echo -a You need to provide a reason to set /away.
halt
}
}
alias back {
if ($away = $true) {
ame is back from: %away.reason (been away for $duration($calc($ctime - %away.time)) $+ ) 10<4Haz7script10 13v2.010>
!away
unset %away.reason
unset %away.time
unset %isaway
unset %nickalert. $+ *
}
else {
echo -a You are not marked as away yet. Use /away <reason> to mark yourself as away.
}
}
and turn it into this
alias away { if ($1) { ame is now away: $1- 10<4Haz7script10 13v2.010> | .away $1- }
else { echo -a You need to provide a reason to set. /away <reason>. }
}
alias back { if ($away) { ame is back from: $awaymsg (been away for $duration($awaytime) $+ ) 10<4Haz7script10 13v2.010> | .away }
else { echo -a You are not marked as away yet. Use /away <reason> to mark yourself as away }
}
no real need to set all them global vars when you can use $awaymsg and $awaytime
on ur dissconect if you are going to still use all them vars
you can do
on *:disconnect:{ unset %away.reason %away.time %isaway %nickalert. $+ * }
and in keeping ur on text event as well as ur other events to what it is you can clean it up abit
on *:text:$($+(*,$me,*)):#: {
if ($away && $window(@Awaylog)) { aline @Awaylog ( $+ $time(HH:nn:sstt) $+ ) [4 $+ $nick $+ ] in 4 $+ # $+ said: $1- }
elseif ($away && !$window(@Awaylog)) {
window -kns @Awaylog
aline @Awaylog 10<4Haz7script10 13v1.010>
aline @Awaylog ( $+ $time(HH:nn:sstt) $+ ) [4 $+ $nick $+ ] in 4 $+ # $+ said: $1-
}
if (!$($+(%,nickalert,.,$nick),2)) { set -u3600 $+(%,nickalert,.,$nick) 1 | .notice $nick is away ( $+ $awaymsg $+ ) (been away for $duration($awaytime) $+ ) 10<4Haz7script10 13v2.010> }
}
oh and one other thing i dont see why you are setting the var %isaway