on *:start: if ($readini(Settings.ini,Away.Config,AutoAway) == on) .timerAway.IdleCheck -o 0 30 Away.IdleCheck
on *:load: {
if (!$readini(AwaySettings.ini,Config,NickEditType)) writeini AwaySettings.ini Config NickEditType Suffix
if (!$readini(AwaySettings.ini,Config,NickPrefix)) writeini AwaySettings.ini Config NickPrefix Away|
if (!$readini(AwaySettings.ini,Config,NickSuffix)) writeini AwaySettings.ini Config NickSuffix |Away
if (!$readini(AwaySettings.ini,Config,NickSetTo)) writeini AwaySettings.ini Config NickSuffix Away
if (!$readini(AwaySettings.ini,Config,AutoAway)) writeini AwaySettings.ini Config AutoAway off
if (!$readini(AwaySettings.ini,Config,AutoAwayTime)) writeini AwaySettings.ini Config AutoAwayTime 900
if (!$readini(AwaySettings.ini,Config,IdleSettings)) writeini AwaySettings.ini Config IdleSettings Suffix~|Idle~Auto away after %time minutes idle
if (!$readini(AwaySettings.ini,Config,LeavingTime)) writeini AwaySettings.ini Config LeavingTime off
if (!$readini(AwaySettings.ini,Config,LeavingTimeFormat)) writeini AwaySettings.ini Config LeavingTimeFormat HH:nn:ss
if (!$readini(AwaySettings.ini,Config,TimeAway)) writeini AwaySettings.ini Config TimeAway off
if (!$readini(AwaySettings.ini,Config,TimeAwayFormat)) writeini AwaySettings.ini Config TimeAwayFormat Short
if (!$readini(AwaySettings.ini,Config,ARChannelMessage)) writeini AwaySettings.ini Config ARChannelMessage off
if (!$readini(AwaySettings.ini,Config,ARPrivateMessage)) writeini AwaySettings.ini Config ARPrivateMessage off
if (!$readini(AwaySettings.ini,Config,MsgChans)) writeini AwaySettings.ini Config MsgChans on
if (!$readini(AwaySettings.ini,Config,MsgQueries)) writeini AwaySettings.ini Config MsgQueries off
if (!$readini(AwaySettings.ini,Config,RespondHilights)) writeini AwaySettings.ini Config RespondHilights on
if (!$readini(AwaySettings.ini,Config,RespondPM)) writeini AwaySettings.ini Config RespondPM on
if (!$readini(AwaySettings.ini,Config,RespondNotice)) writeini AwaySettings.ini Config RespondNotice on
echo -a 13>>> 11Successfully loaded13 $remove($script,$scriptdir) 11- Away System script by13 Urza11.
}
on *:connect: {
if ($group(#away) == on) {
if ($($+(%,Away.Newnick.,$network),2) != $me) nick $ifmatch
!away 11Away: $iif(%Away.Reason,-11 %Away.Reason) $iif(%Away.leavetime,- Left at11 %Away.Leavtime ) $iif($Away.Gonefor,- Gone for11 $Away.Gonefor )
}
}
on *:unload: {
disable #away
unset %away.*
hfree away.*.responses
timerAway.Idlecheck off
}
menu status,channel,query,menubar,@Away.Logs {
-
Away Settings
.Open away options: dialog $iif($dialog(away),-o,-m) away away
.$iif($active == @Away.Logs,Close window):window -c $active
. -
. Set away $+ $chr(58) $iif($group(#away) == off,on,off): {
if ($group(#away) == off) away $?="Enter away reason or leave black for default (if set)"
else back
}
.-
.$iif($group(#away) == on && %Away.Preset == 1,$style(3),$iif($group(#away) == on || !$readini(AwaySettings.ini,Presets,1),$style(2))) Preset 1 - $iif($readini(AwaySettings.ini,Presets,1),$gettok($v1,1,126),Not set):away $gettok($readini(AwaySettings.ini,Presets,1),1,126)
.$iif($group(#away) == on && %Away.Preset == 2,$style(3),$iif($group(#away) == on || !$readini(AwaySettings.ini,Presets,2),$style(2))) Preset 2 - $iif($readini(AwaySettings.ini,Presets,2),$gettok($v1,1,126),Not set):away $gettok($readini(AwaySettings.ini,Presets,2),1,126)
.$iif($group(#away) == on && %Away.Preset == 3,$style(3),$iif($group(#away) == on || !$readini(AwaySettings.ini,Presets,3),$style(2))) Preset 3 - $iif($readini(AwaySettings.ini,Presets,3),$gettok($v1,1,126),Not set):away $gettok($readini(AwaySettings.ini,Presets,3),1,126)
.$iif($group(#away) == on && %Away.Preset == 4,$style(3),$iif($group(#away) == on || !$readini(AwaySettings.ini,Presets,4),$style(2))) Preset 4 - $iif($readini(AwaySettings.ini,Presets,4),$gettok($v1,1,126),Not set):away $gettok($readini(AwaySettings.ini,Presets,4),1,126)
.$iif($group(#away) == on && %Away.Preset == 5,$style(3),$iif($group(#away) == on || !$readini(AwaySettings.ini,Presets,5),$style(2))) Preset 5 - $iif($readini(AwaySettings.ini,Presets,5),$gettok($v1,1,126),Not set):away $gettok($readini(AwaySettings.ini,Presets,5),1,126)
.$iif($group(#away) == on && %Away.Preset == 6,$style(3),$iif($group(#away) == on || !$readini(AwaySettings.ini,Presets,6),$style(2))) Preset 6 - $iif($readini(AwaySettings.ini,Presets,6),$gettok($v1,1,126),Not set):away $gettok($readini(AwaySettings.ini,Presets,6),1,126)
.$iif($group(#away) == on && %Away.Preset == 7,$style(3),$iif($group(#away) == on || !$readini(AwaySettings.ini,Presets,7),$style(2))) Preset 7 - $iif($readini(AwaySettings.ini,Presets,7),$gettok($v1,1,126),Not set):away $gettok($readini(AwaySettings.ini,Presets,7),1,126)
}
dialog away {
title Away System Settings
size -1 -1 150 177
option dbu
tab "Basic Settings" 100,0 0 150 156
tab "Exceptions and Messaging" 200,0 0 150 156
Box "Default Away Settings", 2, 4 15 142 45, tab 100
text "Nick:", 1, 8 28 12 10, tab 100
combo 3, 22 26 50 10, drop tab 100
edit "", 5, 75 26 50 10, tab 100
button "?", 6, 130 26 10 10, tab 100
text "Default Away Message:", 24, 8 39 100 10, tab 100
edit "", 25, 8 47 117 10, autohs tab 100
button "?", 26, 130 47 10 10, tab 100
box "Global Options" 4, 4 62 142 92, tab 100
check "A&uto Away After", 7, 12 71 50 10, tab 100
edit "", 8, 63 71 10 10, tab 100
text "minutes.", 9, 75 72.5 40 10, tab 100
button "?", 10, 130 71 10 10, tab 100
button "options", 27, 98 71 30 10, tab 100
check "Show &Leaving Time?" 11, 12 85 60 10, tab 100
edit "" 12, 75 85 50 10, tab 100
button "?", 13, 130 85 10 10, tab 100
check "Show &Time Away?" 14, 12 100 55 10, tab 100
combo 15, 75 100 50 10, drop tab 100
button "?", 16, 130 100 10 10, tab 100
box "Auto Return" 17, 7 115 136 35, tab 100
text "Cancel away on:" 18, 12 125 80 10, tab 100
check "&Channel Message" 19, 60 124 50 10, tab 100
check "&Private Message" 20, 60 134 50 10, tab 100
button "?", 21, 130 134 10 10, tab 100
;Exception + messaging options: - display only does nothing yet
box "Messaging", 30, 4 15 142 90, tab 200
text "Send messages to:", 31, 8 26 50 10, tab 200
check "All open channels" 32, 60 25 50 10, tab 200
check "All open queries" 33, 60 35 50 10, tab 200
button "?", 34, 130 26 10 10, tab 200
box "Response Messages", 35, 8 48 134 38, tab 200
text "Respond to:", 36, 12 56 50 10, tab 200
check "Channel highlight", 37, 60 55 50 10, tab 200
check "Private message", 38, 60 65 50 10, tab 200
check "Private notice", 39, 60 75 50 10, tab 200
button "?", 40, 130 55 10 10, tab 200
button "Get mIRC hilights", 42, 18 90 50 10, tab 200
button "Modify Hilights", 43, 70 90 50 10, tab 200
button "?", 44, 130 90 10 10, tab 200
box "Exceptions", 45, 4 109 142 24, tab 200
button "Modify Away System Exceptions" 46, 8 118 100 10, tab 200
button "?", 48, 130 118 10 10, tab 200
button "Edit &Presets" 22, 12 159 60 15
button "&Ok" 23, 80 159 60 15, ok
}
dialog Custom.Aways {
title Custom Away Messages
size -1 -1 236 110
option dbu
box "Custom Away Triggers" 1, 4 4 227 85
text "Trigger", 2, 16 12 30 10
text "Nick Settings", 3, 50 12 50 10
text "Away Message", 4, 130 12 50 10
list 5, 10 20 30 50
list 6, 40 20 50 50
list 7, 90 20 134 50, autohs
button "Add", 8, 10 70 50 15
button "Edit", 10, 65 70 50 15
button "Delete", 9, 120 70 50 15
button "Clear", 12, 175 70 50 15
button "OK", 11, 90 90 50 15, OK
}
dialog Idle.Away.Settings {
title Idle Away Settings
size -1 -1 120 85
option dbu
box "Idle away settings", 1, 4 4 112 55
text "Nick Settings:", 2, 8 12 50 10
combo 3, 8 20 50 10, drop
edit "", 4, 62 20 50 10
text "Idle away message:", 5, 8 35 50 10
edit "", 6, 8 43 104 10, autohs
button "&Help" 7, 5 65 50 15
button "&Ok", 8, 65 65 50 15, OK
}
Dialog Idle.Away.Help {
title Away System Help
size -1 -1 150 90
option dbu
box "Idle away help", 1, 4 4 142 60
text "Idle away nick and automatic message settings work in the same way as the default away settings in the main dialog, except that they define the settings used when you are automatically set away from Idle" 2, 8 15 133 25
text "you can use %time to refer to the time you must idle before being set as away", 3, 8 45 133 20
button "&Ok", 4, 50 70 50 15, OK
}
dialog Preset.Settings {
title Preset Settings
size -1 -1 120 100
option dbu
box "Preset settings", 1, 4 4 112 70
text "Trigger:", 2, 8 14 50 10
edit "", 3, 30 13 50 10
text "Nick Settings:", 4, 8 27 50 10
combo 5, 8 35 50 10, drop
edit "", 6, 62 35 50 10
text "Away message:", 7, 8 50 50 10
edit "", 8, 8 58 104 10, autohs
button "&Help" 9, 5 80 50 15
button "&Ok", 10, 65 80 50 15, OK
}
Dialog Preset.Help {
title Away System Help
size -1 -1 150 90
option dbu
box "Presets help", 1, 4 4 142 60
text "Preset nick and Away message settings work in the same way as the default away settings in the main dialog, except that they define the settings used for the preset you are creating" 2, 8 15 133 27
text "To use a preset once you have created it simply type /Away TRIGGER", 3, 8 45 133 20
button "&Ok", 4, 50 70 50 15, OK
}
dialog Away.Exceptions {
title Away System Exceptions
size -1 -1 120 100
option dbu
box "Exceptions" 1, 4 4 112 75
text "Networks" 2, 8 12 50 10, center
list 3, 8 19 50 58
button "Add" 6, 61 20 50 10
button "Delete" 7, 61 34 50 10
button "Edit" 8, 61 49 50 10
button "Clear" 9, 61 63 50 10
button "OK" 10, 35 82 50 15, oks
}
dialog Away.AddException {
title Add Exception
size -1 -1 156 190
option dbu
box "Add Exception" 1, 4 4 148 165
text "Network Name:" 2, 8 16 40 10
edit "" 3, 50 15 60 10
text "If you are unsure of a network name you can type: //echo -a $network in mIRC to view it." 20, 8 30 130 15
box "Exception scope" 4, 8 50 140 55
Text "This exception affects:" 5, 12 60 55 10
radio "Entire network" 6, 69 59 65 10
radio "certain channels only" 7, 69 69 65 10
Text "Enter Channels to be excepted, seperated by spaces." 8, 12 80 130 10
edit "" 9, 12 90 130 10
box "Exception Options" 10, 8 110 140 55
text "On this network:" 11, 12 120 45 10
check "Do not change nick" 12, 55 120 55 10
check "Do not send away messages" 13, 55 130 80 10
check "Do not send hilight responses" 14, 55 140 80 10
check "Do not send PM responses" 15, 55 150 80 10
button "OK" 16, 53 172 50 15, Ok
}
dialog Away.Help.6 {
title Away System Help
size -1 -1 150 120
option dbu
box "Nick Settings Help", 1, 5 5 140 90
text "Nick PREFIX: Adds the specified text to the FRONT of your nick when going away", 2, 8 15 133 20
text "Nick SUFFIX: Adds the specified text to the END of your nick when going away", 3, 8 35 133 20
text "Set to: Sets your nick to the specified nick when you set away", 4, 9 55 133 20
text "Don’t Change: Means that you’re nick will not change when going away or coming back", 5, 8 75 133 20
button "OK", 7, 50 100 50 15, OK
}
dialog Away.Help.10 {
title Away System Help
size -1 -1 150 90
option dbu
box "Auto Away Help", 1, 5 5 140 60
text "Enabling Auto-Away will automatically set you as away if you are idle for the specified time", 2, 8 15 134 20
text "Time must be between 1 and 60 minutes", 3, 8 35 134 20
text "Options for settings Idle nick and message can be found by clicking the options button", 4, 8 45 134 20
button "OK", 5, 50 70 50 15, ok
}
dialog Away.Help.13 {
title Away System Help
size -1 -1 150 80
option dbu
box "Show Leaving Time Help", 1, 5 5 140 50
text "Enabling 'Show Leaving Time' will display the time you went away in all your away messages in the specified Time Format", 2, 8 15 134 20
button "Click Here for a list of codes used in time format", 3, 8 40 134 10
button "OK", 4, 50 60 50 15, ok
}
dialog Away.Help.16 {
title Away System Help
size -1 -1 150 90
option dbu
box "Show Time Away Help", 1, 5 5 140 60
text "Enabling 'Show Time Away' will display how long you have been away in all your away messages in the specified Time Format", 2, 8 15 134 20
text "Example of Short format: 5h 6m 10s" 3, 8 40 134 10
text "Example of Medium format: 5hrs 6mins 10secs" 4, 8 48 134 10
text "Example of long format: 5 hours 6 minutes 10 seconds" 5, 8 56 134 10
button "OK", 6, 50 70 50 15, ok
}
dialog Away.Help.21 {
title Away System Help
size -1 -1 150 65
option dbu
box "Automatic Return Help", 1, 5 5 140 35
text "Enabling 'Automatic Return' will automatically bring you back from away if you send any Channel And/Or Private message", 2, 8 15 134 20
button "OK", 5, 50 45 50 15, ok
}
dialog Away.Help.26 {
title Away System Help
size -1 -1 150 55
option dbu
box "Default Message Help", 1, 5 5 140 27
text "If you do not enter a reason when going away this default will be used", 2, 8 15 134 20
button "OK", 3, 50 35 50 15, ok
}
dialog Away.Help.34 {
title Away System Help
size -1 -1 150 60
option dbu
box "Message sending help", 1, 5 5 140 32
text "These options refer to weather your away message will be sent to channels and/or Pm's (Queries) when leaving and returning.", 2, 8 15 134 20
button "OK", 3, 50 40 50 15, ok
}
dialog Away.Help.40 {
title Away System Help
size -1 -1 150 80
option dbu
box "Auto Response Help", 1, 5 5 140 50
text "These options refer to what actions will trigger an auto message alerting the person that you are away.", 2, 8 15 134 20
text "Channel highlight is triggered whenever someone says a word that is in your hilights list", 3, 8 35 134 20
button "OK", 4, 50 60 50 15, ok
}
dialog Away.Help.44 {
title Away System Help
size -1 -1 150 120
option dbu
box "Hilight help", 1, 5 5 140 92
text "'Hilight' occurs whenever somebody says a word that is in your hilights list.", 2, 8 15 134 20
text "Your away hilights determine what words, when said, will cause the script to notify the person that you are away, and log the message", 3, 8 31 134 20
text "If you have hilights set in mIRC you can click 'Get mIRC Hilights' to have the away system use these same hilights", 4, 8 54 134 20
text "You may also add or modify seperate ones using the 'Modify Hilights' button. Note that Identifiers such as $me (which refers to your current nick) are also allowed" 5, 8 75 134 20
button "OK", 6, 50 100 50 15, ok
}
dialog Away.Help.48 {
title Away System Help
size -1 -1 150 65
option dbu
box "Exceptions help", 1, 5 5 140 35
text "Exceptions allow you to specify networks/channels in which away messages are not sent, or networks in which your nick is not changed", 2, 8 15 134 25
button "OK", 3, 50 45 50 15, ok
}
dialog Away.Help.Time {
title Away System Help
size -1 -1 150 155
option dbu
box "Time Format Help", 1, 5 5 140 120
text "The following is a list of Codes that can be used in Time Formats", 2, 8 15 134 20
box "Time Format Codes", 3, 8 30 134 88
list 4, 20 40 20 75
list 5, 40 40 90 75
button "OK", 6, 50 130 50 15, ok
}
on *:dialog:Away.Help.Time:init:*: {
did -a $dname 4 HH
did -a $dname 5 Hours - 2 Digit 24 hour time - $time(HH)
did -a $dname 4 H
did -a $dname 5 Hours - 1 Digit 24 hour time - $time(H)
did -a $dname 4 hh
did -a $dname 5 Hours - 2 Digit 12 hour time - $time(hh)
did -a $dname 4 h
did -a $dname 5 Hours - 1 Digit 12 hour time - $time(h)
did -a $dname 4 nn
did -a $dname 5 Minutes - 2 Digit - $time(nn)
did -a $dname 4 n
did -a $dname 5 Minutes - 1 Digit - $time(n)
did -a $dname 4 ss
did -a $dname 5 Seconds - 2 Digit - $time(ss)
did -a $dname 4 s
did -a $dname 5 Seconds - 1 Digit - $time(s)
did -a $dname 4 tt
did -a $dname 5 am/pm - Lower case - $time(tt)
did -a $dname 4 TT
did -a $dname 5 AM/PM - Upper Case - $time(TT)
}
on *:dialog:away:init:*: {
;Tab 100 Controls
did -a $+ $iif($readini(AwaySettings.ini,Config,NickEditType) == Prefix,c) $dname 3 Prefix
did -a $+ $iif($readini(AwaySettings.ini,Config,NickEditType) == Suffix,c) $dname 3 Suffix
did -a $+ $iif($readini(AwaySettings.ini,Config,NickEditType) == Set to,c) $dname 3 Set to
did -a $+ $iif($readini(AwaySettings.ini,Config,NickEditType) == Don't Change,c) $dname 3 Don't Change
if ($readini(AwaySettings.ini,Config,NickEditType) == Don't Change) did -m $dname 5
if ($readini(AwaySettings.ini,Config,NickPrefix)) && ($did(away,3).seltext == Prefix) did -ra $dname 5 $readini(AwaySettings.ini,Config,NickPrefix)
if ($readini(AwaySettings.ini,Config,NickSuffix)) && ($did(away,3).seltext == Suffix) did -ra $dname 5 $readini(AwaySettings.ini,Config,NickSuffix)
if ($readini(AwaySettings.ini,Config,NickSetTo)) && ($did(away,3).seltext == Set To) did -ra $dname 5 $readini(AwaySettings.ini,Config,NickSetTo)
if ($readini(AwaySettings.ini,Config,AutoAway) == on) did -c $dname 7 | else did -m $dname 8
if ($readini(AwaySettings.ini,Config,AutoAwayTime)) did -a $dname 8 $calc($ifmatch / 60) | else did -a $dname 8 900
if ($readini(AwaySettings.ini,Config,LeavingTime) == on) did -c $dname 11 | else did -m $dname 12
if ($readini(AwaySettings.ini,Config,LeavingTimeFormat)) did -a $dname 12 $ifmatch | else did -a $dname 12 HH:nn:ss
if ($readini(AwaySettings.ini,Config,TimeAway) == on) did -c $dname 14 | else did -b $dname 15
if ($readini(AwaySettings.ini,Config,TimeAwayFormat) == Short) did -ac $dname 15 Short | else did -a $dname 15 Short
if ($readini(AwaySettings.ini,Config,TimeAwayFormat) == Medium) did -ac $dname 15 Medium | else did -a $dname 15 Medium
if ($readini(AwaySettings.ini,Config,TimeAwayFormat) == Long) did -ac $dname 15 Long | else did -a $dname 15 Long
if ($readini(AwaySettings.ini,Config,ARChannelMessage) == on) did -c $dname 19
if ($readini(AwaySettings.ini,Config,ARPrivateMessage) == on) did -c $dname 20
if ($readini(AwaySettings.ini,Config,DefaultMessage)) did -a $dname 25 $ifmatch
;Tab 200 controls
if ($readini(AwaySettings.ini,Config,MsgChans) == on) did -c $dname 32
if ($readini(AwaySettings.ini,Config,MsgQueries) == on) did -c $dname 33
if ($readini(AwaySettings.ini,Config,RespondHilights) == on) did -c $dname 37
if ($readini(AwaySettings.ini,Config,RespondPM) == on) did -c $dname 38
if ($readini(AwaySettings.ini,Config,RespondNotice) == on) did -c $dname 39
}
on *:dialog:Custom.Aways:init:*: {
var %x = 1
while (%x <= 7) {
if ($readini(AwaySettings.ini,Presets,%x)) {
did -a $dname 5 $gettok($v1,1,126)
did -a $dname 6 $gettok($v1,2,126)
did -a $dname 7 $gettok($v1,3-,126)
}
else halt
inc %x
}
}
on *:dialog:Idle.Away.Settings:init:*: {
tokenize 126 $readini(AwaySettings.ini,n,Config,IdleSettings)
did -a $+ $iif($1 == Prefix,c) $dname 3 Prefix
did -a $+ $iif($1 == Suffix,c) $dname 3 Suffix
did -a $+ $iif($1 == Set to,c) $dname 3 Set to
did -a $+ $iif($1 == Don't Change,c) $dname 3 Don't Change
if ($1 == Don't Change) did -m $dname 5
else did -ra $dname 4 $2
if ($3) did -a $dname 6 $3-
}
on *:dialog:Away.Preset:init:*: {
if (%Away.EditPreset) {
var %pre = %Away.EditPreset, %trigger = $did(Custom.Aways,5).seltext
var %edittype = $gettok($did(Custom.Aways,6).seltext,1,58), %nickedit = $gettok($did(Custom.Aways,6).seltext,2,58)
var %reason = $did(Custom.Aways,7).seltext
did -a $dname 3 %trigger
did -a $+ $iif(%edittype == Prefix,c) $dname 5 Prefix
did -a $+ $iif(%edittype == Suffix,c) $dname 5 Suffix
did -a $+ $iif(%edittype == Set to,c) $dname 5 Set to
did -a $+ $iif(%edittype == Don't Change,c) $dname 5 Don't Change
if (%edittype == Don't Change) did -m $dname 6
else did -ra $dname 6 %nickedit
if (%reason) did -a $dname 8 %reason
}
else {
did -a $dname 5 Prefix
did -a $dname 5 Suffix
did -a $dname 5 Set to
did -a $dname 5 Don't Change
}
}
on *:dialog:Away.Exceptions:init:*: {
var %x = 1,%total = $ini(AwaySettings.ini,Exceptions,0)
while (%x <= %total) {
did -a $dname 3 $ini(AwaySettings.ini,Exceptions,%x)
inc %x
}
}
on *:dialog:Away.AddException:init:*: {
if (%Away.Exception) {
var %info = $readini(AwaySettings.ini,Exceptions,%away.Exception)
var %scope = $gettok(%info,1,126), %options = $gettok(%info,2,126), %chans = $gettok(%info,3-,126)
did -a $dname 3 %Away.Exception
if (%scope == 1) {
did -c $dname 6
did -b $dname 9
}
else {
did -c $dname 7
did -b $dname 12,15
did -e $dname 9
did -a $dname 9 %chans
}
if ($left(%options,1) == 1) && (%scope == 1) did -c $dname 12
if ($mid(%options,2,1) == 1) did -c $dname 13
if ($mid(%options,3,1) == 1) did -c $dname 14
if ($right(%options,1) == 1) && (%scope == 1) did -c $dname 15
}
else {
did -c $dname 6
did -b $dname 9
}
}
on *:dialog:Away.Help.13:sclick:3: {
dialog $iif($dialog(Away.Help.Time),-o,-m) Away.Help.Time Away.Help.Time
dialog -x $dname
}
on *:dialog:Away.Help.Time:sclick:*: {
if ($did == 4) did -c $dname 5 $did(4).sel
elseif ($did == 5) did -c $dname 4 $did(5).sel
}
on *:dialog:away:sclick:*: {
; Tab 100
if ($did == 3) {
writeini AwaySettings.ini Config NickEditType $did(3).seltext
if ($did(3).seltext == Prefix) did -nra $dname 5 $readini(AwaySettings.ini,Config,NickPrefix)
elseif ($did(3).seltext == suffix) did -nra $dname 5 $readini(AwaySettings.ini,Config,NickSuffix)
elseif ($did(3).seltext == Set to) did -nra $dname 5 $readini(AwaySettings.ini,Config,NickSetTo)
else did -rm $dname 5
}
if ($did == 7) && ($did(7).state == 0) did -m $dname 8
elseif ($did == 7) && ($did(7).state == 1) did -n $dname 8
elseif ($did == 11) && ($did(11).state == 0) did -m $dname 12
elseif ($did == 11) && ($did(11).state == 1) did -n $dname 12
elseif ($did == 14) && ($did(14).state == 0) did -b $dname 15
elseif ($did == 14) && ($did(14).state == 1) did -e $dname 15
elseif ($istok(6|10|13|16|21|26|34|40|44|48,$did,124)) dialog $iif($dialog($+(Away.Help.,$did)),-o,-m) $+(Away.Help.,$did) $+(Away.Help.,$did)
elseif ($did == 22) dialog $iif($dialog(Custom.Aways),-o,-m) Custom.Aways Custom.Aways
elseif ($did == 27) dialog $iif($dialog(Idle.Away.Settings),-o,-m) Idle.Away.Settings Idle.Away.Settings
; Tab 200
elseif ($did == 42) {
if ($input(Retrieved the following hilights from your current mIRC settings: $crlf $crlf $+ $Get.Highlights $Crlf $crlf $+ Would you like to use these as your away system highlights? You can use the 'Modify Hilights' button to modify or add to these.,yi,Highlights)) {
writeini AwaySettings.ini Config Hilights $Get.Highlights
}
}
elseif ($did == 43) {
var %hilights = $input(Enter Hilight words or identifiers seperated by commans ONLY. $crlf $+ Eg: $+($me,$chr(44),ALTNICK,$chr(44),$ $+ me),oe,Modify Hilights,$readini(AwaySettings.ini,n,Config,Hilights)))
if (%hilights) writeini AwaySettings.ini Config Hilights $remove(%hilights,$chr(32))
else remini Settings.ini Away.Config Hilights
}
elseif ($did == 46) {
dialog $iif($dialog(Away.Exceptions),-v,-m) Away.Exceptions Away.Exceptions
}
}
on *:dialog:Custom.Aways:sclick:*: {
if ($did == 5) did -c $dname 6,7 $did(5).sel
elseif ($did == 6) did -c $dname 5,7 $did(6).sel
elseif ($did == 7) did -c $dname 5,6 $did(7).sel
elseif ($did == 8) dialog $iif($dialog(Away.Preset),-v,-m) Away.Preset Preset.Settings
elseif ($did == 9) {
if (!$did(5).sel) var %x = $input(Error: You must select an entry to delete,wo,Invalid Selection)
elseif ($?!="Are you sure you want to delete this entry - $did(5).seltext ") {
did -d $dname 5 $did(5).sel
did -d $dname 6 $did(6).sel
did -d $dname 7 $did(7).sel
}
}
elseif ($did == 10) {
if (!$did(5).sel) { var %x = $input(Error: You must select an entry to edit,wo,Invalid Selection) | halt }
set %Away.EditPreset $did(5).sel
dialog $iif($dialog(Away.Preset),-v,-m) Away.Preset Preset.Settings
}
elseif ($did == 12) {
if ($input(Are you sure you want to clear all your presets?,qy,Validation Prompt)) {
var %x = 7
while (%x > 0) {
did -c $dname 5 %x
if ($did(5).seltext) did -d $dname 5,6,7 $did(5).sel
dec %x
}
}
}
}
on *:dialog:Idle.Away.Settings:sclick:*: {
var %time = $calc($readini(AwaySettings.ini,Config,AutoAwayTime) / 60)
if ($did == 3) {
if ($did(3).seltext == Don't Change) did -rm $dname 4
else did -n $dname 4
}
elseif ($did == 7) dialog $iif($dialog(Idle.Away.help),-v,-m) Idle.Away.help Idle.Away.Help
}
on *:dialog:Away.Preset:sclick:*: {
if ($did == 5) {
if ($did(5).seltext == Don't Change) did -rm $dname 6
else did -n $dname 6
}
elseif ($did == 9) dialog $iif($dialog(Preset.Help),-v,-m) Preset.Help Preset.Help
}
on *:dialog:Away.Exceptions:sclick:*: {
if ($did == 6) dialog $iif($dialog(Away.AddException),-v,-m) Away.AddException Away.AddException
elseif ($did == 7) {
if (!$did(3).sel) var %x = $input(You must select an entry to delete,wo,Invalid Selection)
elseif ($?!="Are you sure you want to delete this entry - $did(3).seltext ") {
remini AwaySettings.ini Exceptions $did(3).seltext
did -d $dname 3 $did(3).sel
}
}
elseif ($did == 8) {
if (!$did(3).sel) var %x = $input(You must select an entry to edit,wo,Invalid Selection)
else {
set %Away.Exception $did(3).seltext
set %Away.ExceptionNum $did(3).sel
dialog $iif($dialog(Away.AddException),-v,-m) Away.AddException Away.AddException
}
}
elseif ($did == 9) {
if ($input(Are you sure you want to clear all your network exceptions?,qy,Validation Prompt)) {
var %x = $did(3).lines
remini AwaySettings.ini Exceptions
while (%x > 0) {
did -c $dname 3 %x
if ($did(3).seltext) did -d $dname 3 $did(3).sel
dec %x
}
}
}
}
on *:dialog:Away.AddException:Sclick:*: {
if ($did == 6) {
did -e $dname 12,15
did -b $dname 9
did -r $dname 9
}
elseif ($did == 7) {
did -b $dname 12,15
did -e $dname 9
if ($did(12).state == 1) did -u $dname 12
if ($did(15).state == 1) did -u $dname 15
}
}
on *:dialog:Away:close:*: {
; tab 100 settings
if ($did(5)) {
if ($did(3).seltext == Prefix) writeini AwaySettings.ini Config NickPrefix $did(5)
elseif ($did(3).seltext == Suffix) writeini AwaySettings.ini Config NickSuffix $did(5)
elseif ($did(3).seltext == Set to) writeini AwaySettings.ini Config NickSetTo $did(5)
}
else {
writeini AwaySettings.ini Config NickPrefix Away|
writeini AwaySettings.ini Config NickSuffix |Away
}
writeini AwaySettings.ini Config AutoAway $iif($did(7).state == 0,off,on)
writeini AwaySettings.ini Config AutoAwayTime $iif($did(8),$calc($did(8) * 60),900)
writeini AwaySettings.ini Config LeavingTime $iif($did(11).state == 0,off,on)
writeini AwaySettings.ini Config LeavingTimeFormat $iif($did(12),$did(12),HH:nn:ss)
writeini AwaySettings.ini Config TimeAway $iif($did(14).state == 0,off,on)
writeini AwaySettings.ini Config TimeAwayFormat $iif($did(15),$did(15),Shorts)
writeini AwaySettings.ini Config ARChannelMessage $iif($did(19).state == 0,off,on)
writeini AwaySettings.ini Config ARPrivateMessage $iif($did(20).state == 0,off,on)
if ($did(25)) writeini AwaySettings.ini Config DefaultMessage $did(25)
else remini Settings.ini Away.Config DefaultMessage
if ($readini(AwaySettings.ini,Config,AutoAway) == on) .timerAway.IdleCheck -o 0 30 Away.IdleCheck
elseif ($timer(Away.IdleCheck)) .timerAway.IdleCheck off
;Tab 200 settings
writeini AwaySettings.ini Config MsgChans $iif($did(32).state == 0,off,on)
writeini AwaySettings.ini Config MsgQueries $iif($did(33).state == 0,off,on)
writeini AwaySettings.ini Config RespondHilights $iif($did(37).state == 0,off,on)
writeini AwaySettings.ini Config RespondPM $iif($did(38).state == 0,off,on)
writeini AwaySettings.ini Config RespondNotice $iif($did(39).state == 0,off,on)
}
on *:dialog:Custom.Aways:close:*: {
var %x = 1, %lines = $did(5).lines
while (%x <= %lines) {
did -c $dname 5,6,7 %x
writeini AwaySettings.ini presets %x $+($did(5).seltext,~,$did(6).seltext,~,$did(7).seltext)
inc %x
}
dec %x
while (%x < 7) {
inc %x
if ($readini(AwaySettings.ini,presets,%x)) remini AwaySettings.ini Presets %x
}
}
on *:dialog:Idle.Away.Settings:close:*: {
writeini AwaySettings.ini Config IdleSettings $+($did(3).seltext,~,$iif($did(4),$ifmatch,IDLE),~,$iif($did(6),$ifmatch,Auto away after % $+ time minutes idle))
}
on *:dialog:Away.Preset:close:*: {
var %pre = %away.EditPreset
if (!$did(3)) var %x = $input(Error: No trigger was specified,ow,Input Error)
elseif (!$did(6)) && ($did(5).seltext != Don't Change) var %x = $input(Error: You did not specify $iif($did(5).seltext,a nick $iif($did(5).seltext == set to,to change to,$ifmatch),any nick settings),ow,Input Error)
elseif ($remove($did(6),$chr(91),$chr(93),$chr(92),$chr(45),$chr(95),$chr(123),$chr(124),$chr(125)) !isalnum) && ($did(6)) { var %x = $input(Error: Invalid Characters detected in specified nick,wo,Input Error) | halt }
elseif (!$did(5).seltext) var %x = $input(Error: You have not specified how to change your nick - Select an option from the nick settings drop down,ow,Error)
elseif ($numtok($did(3),32) > 1) || ($numtok($did(6),32) > 1) var %x = $input(Error: Trigger and nick Settings can each only be one word long,wo,Input Error)
else {
did $iif(%pre,-o,-a) Custom.Aways 5 $iif(%pre,%pre) $did(3)
did $iif(%pre,-o,-a) Custom.Aways 6 $iif(%pre,%pre) $did(5).seltext $+ $iif($did(5).seltext != Don't Change,: $did(6))
did $iif(%pre,-o,-a) Custom.Aways 7 $iif(%pre,%pre) $did(8)
unset %away.EditPreset
}
}
on *:dialog:Away.AddException:close:*: {
if (!$did(3)) var %x = $input(No Network name was entered,wo,Input Error)
elseif ($numtok($did(3),32) > 1) var %x = $input(Network name may not contain spaces,wo,Input Error)
else {
var %scope = $iif($did(6).state == 1,1,2)
var %x = 1, %numchans = $numtok($did(9),32)
while (%x <= %numchans) {
var %token = $gettok($did(9),%x,32)
if (#?* iswm %token) var %chans = %chans %token
elseif (%token != $chr(35)) var %chans = %chans $+($chr(35),%token)
inc %x
}
var %x = 12
while (%x <= 15) {
var %options = %options $+ $did(%x).state
inc %x
}
did $iif(%Away.ExceptionNum,-o,-a) Away.Exceptions 3 $iif(%Away.ExceptionNum,$ifmatch) $did(3)
writeini AwaySettings.ini Exceptions $did(3) $+(%scope,~,%options,~,%chans)
unset %Away.Exception*
}
}
alias away {
if ($timer(Away.IdleCheck)) .timerAway.IdleCheck off
set %Away.Hilights $readini(awaySettings.ini,n,Config,Hilights)
.enable #away
var %time = $calc($readini(AwaySettings.ini,Config,AutoAwayTime) / 60)
if ($1) set %away.Reason $1-
elseif ($readini(AwaySettings.ini,Config,DefaultMessage)) set %away.Reason $v1
set %Away.LeftAt $ctime
if ($readini(AwaySettings.ini,Config,LeavingTime) == on) {
var %LeavingTimeFormat = $readini(AwaySettings.ini,Config,LeavingTimeFormat)
set %away.LeaveTime $time(%LeavingTimeFormat)
}
If ($1- = Auto.Idle.Away) {
var %IdleInfo = $readini(AwaySettings.ini,Config,IdleSettings)
var %edittype = $gettok(%IdleInfo,1,126)
if (%edittype == Set to) var %nickset = $gettok(%IdleInfo,2,126)
else var %nickadd = $gettok(%IdleInfo,2,126)
set %Away.Reason $($gettok(%IdleInfo,3-,126),2)
}
else {
var %edittype = $readini(AwaySettings.ini,Config,NickEditType)
if (%edittype == Set To) var %nickset = $readini(AwaySettings.ini,Config,NickSetTo)
else var %nickadd = $readini(AwaySettings.ini,Config,Nick $+ %edittype)
}
var %x 1
while (%x <= 7) {
if ($readini(AwaySettings.ini,Presets,%x)) {
var %preset = $v1
if ($1- == $gettok(%preset,1,126)) {
var %edittype = $gettok($gettok(%preset,2,126),1,58)
var %nickadd = $remove($gettok($gettok(%preset,2,126),2,58),$chr(32))
set %Away.Reason $gettok(%preset,3-,126)
set %Away.Preset %x
var %x = 7
}
}
inc %x
}
; ----- Cycle Connections to change nick/send msg
var %x = 1, %connections = $scon(0)
while (%x <= %connections) {
scon %x
if ($status == connected) {
unset %Except.*
if ($readini(AwaySettings.ini,Exceptions,$network)) {
var %Except.info = $v1
var %Except.Scope = $gettok(%Except.info,1,126)
var %Except.Options = $gettok(%Except.info,2,126)
if (%Except.Scope == 2) && ($mid(%Except.Options,2,1) == 1) var %Except.NoMsgChans = $gettok(%Except.Info,3-,126)
if (%Except.Scope == 1) && ($left(%Except.Options,1) == 1) var %Except.NoNickChange = 1
if (%Except.Scope == 1) && ($mid(%Except.Options,2,1) == 1) var %Except.NoAwayMsg = 1
}
set $+(%,Away.Oldnick.,$network) $me
if ($readini(AwaySettings.ini,Config,NickEditType) != Don't Change) && (!%Except.NoNickChange) {
if (%edittype == Set To) && (%NickSet != $me) var %newnick = %NickSet
if (%edittype == Prefix) && ($+(%nickadd,*) !iswm $me) var %newnick = $+(%nickadd,$me)
if (%edittype == Suffix) && ($+(*,%nickadd) !iswm $me) var %newnick = $+($me,%nickadd)
set $+(%,Away.Newnick.,$network) $iif(%newnick,$ifmatch,$me)
if (%newnick) nick %newnick
}
if ($chan(0)) && ($readini(AwaySettings.ini,Config,MsgChans) == on) && (!%Except.NoAwayMsg) {
var %Chan = 1, %TotalChans = $chan(0)
while (%chan <= %TotalChans) {
if (!$istok(%Except.NoMsgChans,$chan(%chan),32)) describe $chan(%chan) is now 11away $iif(%Away.Reason,-11 %Away.Reason) $iif(%Away.leavetime,- Left at11 %Away.Leavetime )
inc %chan
}
}
if ($readini(AwaySettings.ini,Config,MsgQueries) == on) && (!%Except.NoAwayMsg) {
qme is now 11away $iif(%Away.Reason,-11 %Away.Reason) $iif(%Away.leavetime,- Left at11 %Away.Leavetime )
}
!away Away: $iif(%Away.Reason,-11 %Away.Reason) $iif(%Away.leavetime,- Left at11 %Away.Leavetime )
}
inc %x
}
}
alias back {
var %x = 1, %connections = $scon(0)
while (%x <= %connections) {
scon %x
if ($status == connected) {
unset %Except.*
if ($readini(AwaySettings.ini,Exceptions,$network)) {
var %Except.info = $v1
var %Except.Scope = $gettok(%Except.info,1,126)
var %Except.Options = $gettok(%Except.info,2,126)
if (%Except.Scope == 2) && ($mid(%Except.Options,2,1) == 1) var %Except.NoMsgChans = $gettok(%Except.Info,3-,126)
if (%Except.Scope == 1) && ($left(%Except.Options,1) == 1) var %Except.NoNickChange = 1
if (%Except.Scope == 1) && ($mid(%Except.Options,2,1) == 1) var %Except.NoAwayMsg = 1
}
if (!%Except.NoNickChange) && ($($+(%,Away.Oldnick.,$network),2)) nick $ifmatch
if ($chan(0)) && ($readini(AwaySettings.ini,Config,MsgChans) == on) && (!%Except.NoAwayMsg) {
var %Chan = 1, %TotalChans = $chan(0)
while (%chan <= %TotalChans) {
if (!$istok(%Except.NoMsgChans,$chan(%chan),32)) describe $chan(%chan) is 11back from $iif(%away.Reason,-11 %Away.Reason) $iif(%Away.Leavetime,- Left at11 %Away.Leavetime ) $iif($Away.GoneFor,- Gone for11 $Away.GoneFor )
inc %chan
}
}
if ($readini(AwaySettings.ini,Config,MsgQueries) == on) && (!%Except.NoAwayMsg) {
qme is now 11away $iif(%Away.Reason,-11 %Away.Reason) $iif(%Away.leavetime,- Left at11 %Away.Leavetime )
}
!away
}
inc %x
}
.disable #away
unset %away.*
if ($hget(Away.PM.Responses)) || ($hget(Away.Highlight.Responses)) hfree -w Away.*.Responses
if ($readini(AwaySettings.ini,Config,AutoAway) == on) .timerAway.IdleCheck -o 0 30 Away.IdleCheck
}
alias -l Away.Gonefor {
if ($readini(AwaySettings.ini,Config,TimeAway) == on) {
var %TimeAwayFormat = $readini(AwaySettings.ini,Config,TimeAwayFormat)
if (%Away.LeftAt) {
var %duration = $duration($calc($ctime - %Away.LeftAt),%TimeAwayFormat)
if (%TimeAwayFormat == Short) return $Short.Duration(%duration)
elseif (%TimeAwayFormat == medium) return %duration
elseif (%TimeAwayFormat == long) return $Long.Duration(%duration)
}
}
else return $false
}
alias -l Short.Duration return $replacex($1-,secs,s,sec,s,mins,m,min,m,hrs,h,hr,h,days,d,day,d,wks,w,wk,w)
alias -l Long.Duration return $replacex($1-,sec,second,secs,seconds,min,minute,mins,minutes,hr,hour,hrs,hours,wk,week,wks,weeks)
alias -l Get.Highlights {
var %x = 1, %Groups = $ini(mirc.ini,highlight,0)
while (%x <= %groups) {
var %Away.Highlights = $addtok(%Away.highlights,$highlight(%x),44)
inc %x
}
return %Away.Highlights
}
alias -l Check.For.highlights {
if (!%Away.Highlights) set %Away.Highlights $readini(AwaySettings.ini,n,Config,Hilights)
var %x = 1, %highlights = $numtok(%Away.highlights,44)
while (%x <= %highlights) {
var %chighlight = $($gettok(%Away.Highlights,%x,44),2)
if ($istok($1-,%chighlight,32)) return %chighlight
inc %x
}
return $false
}
alias -l Away.Logwin {
if (!$window(@Away.Logs)) window -eknz @Away.Logs
echo -ti2 @Away.Logs $1-
}
alias -l Highlight.Response {
if (!$hget(Away.highlight.Responses,$+($1,.,$2))) {
scid $1 .notice $2 11I am currently away $iif(%Away.Reason,-13 %Away.Reason) $iif(%Away.LeaveTime,11- Left at13 %Away.LeaveTime) $iif($away.gonefor,11- Gone for13 $away.gonefor) 11- One time response to highlight.
hadd -m Away.Highlight.Responses $+($1,.,$2) 1
}
}
alias -l Private.Message.Response {
if (!$hget(Away.PM.Responses,$+($1,.,$2))) {
scid $1 .notice $2 11I am currently away $iif(%Away.Reason,-13 %Away.Reason) $iif(%Away.LeaveTime,11- Left at13 %Away.LeaveTime) $iif($away.gonefor,11- Gone for13 $away.gonefor) 11- One time response to Private Message.
hadd -m Away.PM.Responses $+($1,.,$2) 1
}
}
alias -l Away.IdleCheck {
var %x = 1, %networks = $scon(0)
var %AutoAwayTime = $readini(AwaySettings.ini,Config,AutoAwayTime)
while (%x <= %networks) {
scon %x {
if ($status == Connected) && ($idle < %AutoAwayTime) var %Idle = off
}
inc %x
}
if (%idle != off) away Auto.Idle.Away
}
alias Away.Config dialog $iif($dialog(Away),-v,-m) Away Away
#away off
;Hilight responses
on *:text:*:#: {
if (!$Check.For.highlights($1-)) && (!$istok($1-,$me,32)) && (!$istok($1-,$($+(%,Away.Oldnick.,$network),2),32)) return
else {
Away.Logwin 13[11CHANNEL MESSAGE13] $+(13[11,$iif($scon(0) > 1,$+($network,13/11)),$chan,13/11,$nick,13]) $1-
if ($readini(AwaySettings.ini,Exceptions,$network)) {
var -s %Except.info = $v1
var -s %Except.Scope = $gettok(%Except.info,1,126), %Except.Options = $gettok(%Except.info,2,126)
if (%Except.Scope == 2) && ($mid(%Except.Options,3,1) == 1) var %Except.NoHilight = $gettok(%Except.Info,3-,126)
elseif (%Except.Scope == 1) && ($mid(%Except.Options,3,1) == 1) return
}
if (!$istok(%Except.NoHilight,$chan,32)) && ($readini(AwaySettings.ini,Config,RespondHilights) == on) Highlight.Response $cid $nick
}
}
on *:action:*:#: {
if (!$check.for.highlights($1-)) && (!$istok($1-,$me,32)) && (!$istok($1-,$($+(%,Away.Oldnick.,$network),2),32)) return
else {
Away.Logwin 13[11CHANNEL 11ACTION13] $+(13[11,$iif($scon(0) > 1,$+($network,13/11)),$chan,13/11,$nick,13]) * $nick $1-
if ($readini(AwaySettings.ini,Exceptions,$network)) {
var %Except.info = $v1
var %Except.Scope = $gettok(%Except.info,1,126), %Except.Options = $gettok(%Except.info,2,126)
if (%Except.Scope == 2) && ($mid(%Except.Options,3,1) == 1) var %Except.NoHilight = $gettok(%Except.Info,3-,126)
elseif (%Except.Scope == 1) && ($mid(%Except.Options,3,1) == 1) return
}
if (!$istok(%Except.NoHilight,$chan,32)) && ($readini(AwaySettings.ini,Config,RespondHilights) == on) Highlight.Response $cid $nick
}
}
on *:notice:*:?: {
if (*serv !iswm $nick) {
Away.Logwin 13[11PRIVATE NOTICE13] $+(13[11,$iif($scon(0) > 1,$+($network,13/11)),Private,13/11,$nick,13]) $1-
if ($readini(AwaySettings.ini,Exceptions,$network)) {
var %Except.info = $v1
var %Except.Scope = $gettok(%Except.info,1,126), %Except.Options = $gettok(%Except.info,2,126)
if (%Except.Scope == 1) && ($right(%Except.Options,1) == 1) return
}
if ($readini(AwaySettings.ini,Config,RespondNotice) == on) Private.Message.Response $cid $nick
}
}
on *:text:*:?: {
if ($readini(AwaySettings.ini,Config,RespondPM) == on) && (*serv !iswm $nick) {
if ($readini(AwaySettings.ini,Exceptions,$network)) {
var %Except.info = $v1
var %Except.Scope = $gettok(%Except.info,1,126), %Except.Options = $gettok(%Except.info,2,126)
if (%Except.Scope == 2) && ($mid(%Except.Options,3,1) == 1) var %Except.NoHilight = $gettok(%Except.Info,3-,126)
elseif (%Except.Scope == 1) && ($right(%Except.Options,1) == 1) return
}
Private.Message.Response $cid $nick
}
}
on *:input:#: {
if ($left($1,1) != $readini(mirc.ini,text,commandchar)) {
if ($readini(AwaySettings.ini,Config,ARChannelMessage) == on) back
}
}
on *:input:?: {
if ($left($1,1) != $readini(mirc.ini,text,commandchar)) {
if ($readini(AwaySettings.ini,Config,ARPrivateMessage) == on) back
}
}
#away end