Snippets Project Page
Author: entropy
Added: 5y
Updated: 43w
mIRC: 7.52+
Hits: 2,203
Downloads: 65
Review: entropy
Size: 21.2KB
2 0
Login to vote.
Away System
v2.0
This snippet is fully featured and powerful.
This snippet manages your aways on all networks.
I hope you enjoy this snippet!
Download
JSON
▲ Review
▲ Log
▼ Source
; Away System v2.0 - by entropy 2023 (released 6/21/23) ;================================================================= MENUS menu menubar,status,channel,query { - $iif($server,Away System $sversion) { awaysys } - } ;================================================================= MAIN EVENTS on *:start:{ if (!$isfile($qt($scriptdirawaymessages.txt))) { write -c $qt($scriptdirawaymessages.txt) } if (!$isfile($qt($scriptdirawayreasons.txt))) { write -c $qt($scriptdirawayreasons.txt) } if (!$isfile($qt($scriptdirawayverbose.txt))) { write -c $qt($scriptdirawayverbose.txt) } if (!$isfile($qt($scriptdirawaynicks.txt))) { write -c $qt($scriptdirawaynicks.txt) } unset %away_status %away_reason %away_msgs %away_gone .titlebar [HERE] } on *:exit:{ unset %away_status %away_reason %away_msgs %away_gone } on *:connect:{ .timercheckawayidle -o 0 1 checkidle } on *:disconnect:{ if ($dialog(awaysys)) { did -b awaysys 5 | did -c awaysys 5 | did -ue awaysys 4 | did -e awaysys 2 } } on *:load:{ .timercheckawayidle -o 0 1 checkidle | echomsg Welcome to $_b(Away System $sversion) - by $_b(entropy) 2020 - Script: $_b($qt($nopath($script))) has been loaded! } on *:unload:{ if (%away_status) { scon -at1 !away } unset %away_status %away_reason %away_msgs %away_gone .timerupdatethis off .timercheckawayidle off if ($dialog($qt($scriptdirawaysys))) { dialog -x awaysys } if ($isfile($qt($scriptdirawaymessages.txt))) { .remove $qt($scriptdirawaymessages.txt) } if ($isfile($qt($scriptdirawayreasons.txt))) { .remove $qt($scriptdirawayreasons.txt) } if ($isfile($qt($scriptdirawayverbose.txt))) { .remove $qt($scriptdirawayverbose.txt) } if ($isfile($qt($scriptdirawaynicks.txt))) { .remove $qt($scriptdirawaynicks.txt) } echomsg Script: $_b($qt($nopath($script))) has been unloaded! Thanks for using this script! } ;================================================================= MAIN ALIASES alias -l awaysys { dialog $iif($dialog(awaysys),-x,-m) awaysys awaysys } alias -l echomsg { echo $iif($color(back) == 0 || $color(back) == 36,02,11) -tag * [AWAY] $1- } alias -l _b { return $+($chr(2),$1-,$chr(2)) } alias -l _f { return $remove($replace($duration($calc($ctime + 1 - %away_gone)),wks,w,wk,w,days,d,day,d,hrs,h,hr,h,mins,m,min,m,secs,s,sec,s),$chr(32)) } alias -l _c { return $chr(9679) } alias -l updatetitle { if ($dialog(awaysys)) { dialog -t awaysys Away System $sversion - $iif(%away_status,[AWAY] - Gone: $_f,[HERE]) } | titlebar $iif(%away_status,[AWAY] - Gone: $_f,[HERE]) } alias -l isreason { var %a = 1, %b | while ($read(awayreasons.txt,%a)) { %b = $v1 | if (%b == $1-) { return $true } | inc %a } | return $false } alias -l all { if (!$dialog(awaysys)) { return } | did $iif($1 == e,-e,-b) awaysys 1,2,3,6,7,8,10,11,12,16,17,18,19,20,21,24,25,27,28,29 } alias -l smart { var %a = 1, %b, %c = brb bbl afk bbiaf bbiab bbs | while ($gettok(%c,%a,32)) { %b = $v1 | if ($+(%b,*) iswm $1) { return $true } | inc %a } | return $false } alias -l sversion { return v2.0 } alias -l syear { return 2023 } alias -l sauthor { return entropy } alias -l verbose { if (%away_reason && %away_verbose == on) { if (%away_method == message) { var %method = message } else { var %method = action } var %a = 1, %b while ($scon(%a)) { scid $v1 if ($read(awayverbose.txt,wn,$network *)) { var %x = 1, %y, %l = $gettok($v1,2-,32) if (%l == all) { while ($chan(%x)) { %y = $v1 $+(.timerawayverbose,$network,%y) 1 1 $iif(%method == message,msg,describe) $unsafe( %y ) $unsafe( $1- ) inc %x } } else { var %x = 1, %y while ($gettok(%l,%x,32)) { %y = $v1 if (%y ischan) { $+(.timerawayverbose,$network,%y) 1 1 $iif(%method == message,msg,describe) $unsafe( %y ) $unsafe( $1- ) } inc %x } } } inc %a } scid -r if ($read(awayverbose.txt,wn,all *)) { var %c = $gettok($v1,2-,32) if (%c == all) { var %x = 1, %y while ($scon(%x)) { %y = $v1 scid %y var %o = 1, %n while ($chan(%o)) { %n = $v1 $+(.timerawayverbose,$network,%n) 1 1 $iif(%method == message,msg,describe) $unsafe( %n ) $unsafe( $1- ) inc %o } inc %x } scid -r } else { var %x = 1, %y while ($scon(%x)) { %y = $v1 scid %y var %a = 1, %n while ($gettok(%c,%a,32)) { %n = $v1 if (%n ischan) { $+(.timerawayverbose,$network,%n) 1 1 $iif(%method == message,msg,describe) $unsafe( %n ) $unsafe( $1- ) } inc %a } inc %x } scid -r } } } } alias -l setnick { if (%away_reason && %away_nicks == on) { var %a = 1, %b while ($scon(%a)) { scid $v1 if ($read(awaynicks.txt,wn,$network *)) { var %l = $gettok($v1,2-,32) if ($numtok(%l,32) == 2) { $+(.timerawaynick,$network) -om 1 500 nick $iif($1 == main,$gettok(%l,1,32),$gettok(%l,2,32)) } } inc %a } scid -r } } alias -l undo { if ($dialog(awaysys)) { if (!%away_status) { all e | did -b awaysys 5 | did -c awaysys 5 | did -ue awaysys 4 } else { all b | did -b awaysys 4 | did -c awaysys 4 | did -ue awaysys 5 } } echomsg Away Flood Protection has expired. } alias -l gettime { var %a = 1, %b, %c = $replace($1,w,$+(w,$chr(1)),d,$+(d,$chr(1)),h,$+(h,$chr(1)),m,$+(m,$chr(1)),s,$+(s,$chr(1))), %secs = 0 while ($gettok(%c,%a,1)) { %b = $v1 if (w isin %b) { inc %secs $calc($remove(%b,w) * 60 * 60 * 24 * 7) } if (d isin %b) { inc %secs $calc($remove(%b,d) * 60 * 60 * 24) } if (h isin %b) { inc %secs $calc($remove(%b,h) * 60 * 60) } if (m isin %b) { inc %secs $calc($remove(%b,m) * 60) } if (s isin %b) { inc %secs $remove(%b,s) } inc %a } if (%secs == 0) { return $1 } else { return %secs } } alias -l checkidle { var %a = $gettime(%away_idle) if (!%away_status && %a != 0 && $server) { if ($idle >= %a) { away $iif(%away_idle isnum, $remove($replace($duration(%away_idle),wks,w,wk,w,days,d,day,d,hrs,h,hr,h,mins,m,min,m,secs,s,sec,s),$chr(32)),%away_idle) idle if ($dialog(awaysys)) { did -c awaysys 4 did -b awaysys 4 did -ue awaysys 5 var %a = 1, %b, %found = no, %line while ($read(awayreasons.txt,%a)) { %b = $v1 if (%b == %away_reason) { %found = yes | %line = %a | break } inc %a } if (%found == no) { did -ac awaysys 2 %away_reason } else { did -c awaysys 2 %line } did -b awaysys 2 } } } } alias away { if (!$server) { echomsg You are not connected to any server! } elseif ($timer(awayflood)) { echomsg You must wait $_b($+($timer(awayflood).secs,s)) to go away again! | did -b awaysys 4,5 } elseif (!$1) { if (%away_status == away) { if (%away_wait) { if ($dialog(awaysys)) { did -ue awaysys 5 did -b awaysys 4 did -c awaysys 4 } noop $input(You recently used this command. Please wait $var(%away_wait,1).secs seconds and try again.,12,Prompt) return } scon -at1 !away updatetitle if ($dialog(awaysys)) { dialog -t awaysys Away System $sversion - [HERE] all e did -b awaysys 5 did -c awaysys 5 did -ue awaysys 4 did -u awaysys 2 } titlebar [HERE] .timerupdatethis off scon -at1 .resetidle set -u10 %away_wait $ctime } else { echomsg You are not away! } } else { if (!%away_status) { if (%away_wait) { if ($dialog(awaysys)) { did -ue awaysys 4 did -b awaysys 5 did -c awaysys 5 } noop $input(You recently used this command. Please wait $var(%away_wait,1).secs seconds and try again.,12,Prompt) return } scon -at1 !away $strip($1-) %away_status = away %away_reason = $strip($1-) %away_msgs = 0 var %a = 1, %b, %found = no, %line if ($dialog(awaysys)) { while ($did(awaysys,2,%a)) { %b = $v1 if (%b == $1-) { %found = yes | %line = %a | break } inc %a } } if (%found == no) { if ($dialog(awaysys)) { did -ac awaysys 2 $strip($1-) } | if (!$isreason($strip($1-))) { write awayreasons.txt $strip($1-) } } elseif ($dialog(awaysys)) { did -c awaysys 2 %line } if ($dialog(awaysys) && !$did(awaysys,2)) { did -c awaysys 2 No reason } updatetitle .timerupdatethis -o 0 1 updatetitle if ($dialog(awaysys)) { all b did -c awaysys 4 did -ue awaysys 5 } set -u10 %away_wait $ctime } else { echomsg You are already away! } } } ;================================================================= ON INPUT on *:input:*:{ if (/* !iswm $1 && $server && $active != Status Window) { if ($query($active) || $chan($active)) { scon -at1 .resetidle if (%away_status && %away_cancel == yes) { unset %away_wait | away } elseif (!%away_status && $smart($strip($1)) && %away_smart == on) { away $strip($1-) } } } } ;================================================================= DIALOG dialog awaysys { title "Away System" size -1 -1 566 290 option pixels notheme check "Away", 4, 10 256 78 25, push check "Back", 5, 88 256 78 25, push button "OK", 9, 483 256 75 25, ok button "Unload", 13, 405 256 78 25 tab "Main", 14, 10 9 548 241 text "Away Reason:", 1, 23 44 73 16, tab 14 combo 2, 100 42 391 156, tab 14 sort size edit drop text "Messages:", 7, 23 68 50 16, tab 14 list 8, 22 84 528 131, tab 14 size extsel hsbar vsbar button "Delete", 10, 491 216 57 20, tab 14 button "Clear", 17, 490 42 57 19, tab 14 tab "Options", 15 text "Idle Away:", 11, 19 44 57 16, tab 15 right edit "", 6, 79 40 61 23, tab 15 check "Cancel away on activity", 12, 210 41 136 20, tab 15 check "Away Verbose", 3, 21 65 93 20, tab 15 edit "", 16, 20 84 185 151, tab 15 multi return autohs autovs hsbar vsbar check "Away Nicknames", 18, 210 65 102 20, tab 15 edit "", 19, 210 84 180 150, tab 15 multi return autohs autovs hsbar vsbar check "Smart Away", 21, 396 41 82 20, tab 15 text "Verbose Method:", 20, 396 68 120 16, tab 15 radio "Action", 24, 395 84 55 20, tab 15 radio "Message", 25, 454 84 64 20, tab 15 check "Away Notices", 27, 396 108 87 20, tab 15 edit "", 29, 395 149 152 41, tab 15 multi hsbar text "Away Notice Message:", 28, 396 133 120 16, tab 15 tab "Help", 22 edit "", 23, 18 42 531 195, tab 22 read multi return autovs vsbar } ;================================================================= DIALOG EVENTS on *:dialog:awaysys:init:0:{ if (%away_text) { did -ra awaysys 29 $v1 } if (%away_notices == yes) { did -c awaysys 27 } if (%away_method == message) { did -c awaysys 25 } else { did -c awaysys 24 } if (%away_smart == on) { did -c awaysys 21 } updatetitle var %a = 1, %b while ($read(awaymessages.txt,%a)) { did -za awaysys 8 $v1 | inc %a } if (%away_statuts == away) { did -c awaysys 6 | did -b awaysys 6 } else { did -c awaysys 5 | did -b awaysys 5 } var %a = 1, %b while ($read(awayreasons.txt,%a)) { %b = $v1 did -a awaysys 2 %b inc %a } if (%away_status) { var %a = 1, %b, %c = %away_reason while ($did(2,%a).text) { %b = $v1 if (%b == %c) { did -c awaysys 2 %a | break } inc %a } did -cb awaysys 4 did -ue awaysys 5 all b } else { did -e awaysys 6,7,8,10,11,12 } did -ra awaysys 6 $iif(%away_idle,$v1,0) if (%away_cancel) { did -c awaysys 12 } if ($timer(awayflood) && !%away_status) { all b did -c awaysys 5 did -u awaysys 4 } if (%away_verbose == on) { did -c awaysys 3 } if ($read(awayverbose.txt,1)) { loadbuf -o awaysys 16 awayverbose.txt } if (%away_nicks == on) { did -c awaysys 18 } if ($read(awaynicks.txt,1)) { loadbuf -o awaysys 19 awaynicks.txt } if (%away_tab) { .timer -m 1 10 did -c awaysys $v1 } did -a awaysys 23 ===========================[ NOTICE ]============================= $+ $crlf $+ $crlf did -a awaysys 23 Please note that an away message/nick change on away is frowned upon by a lot of people. You could get banned by using these on some networks/channels. Use at your OWN RISK! $crlf $+ $crlf did -a awaysys 23 ==========================[ IDLE AWAY ]=========================== $+ $crlf $+ $crlf did -a awaysys 23 Idle Away: "0" to disable going away on idle. Type: "1800" for 30mins (1800 seconds). Type: "1h30m23s" for (5423 seconds). $crlf $+ $crlf did -a awaysys 23 =========================[ AWAY VERBOSE ]========================== $+ $crlf $+ $crlf did -a awaysys 23 Away Verbose: "Network #chan1 #chan2 #chan3" To advertise your away messages to this network/chans. $crlf $+ $crlf did -a awaysys 23 Example Verbose: "mIRCScripts #chat #opers" To advertise your away messages to network "mIRCScripts" and channels "#chat #opers". $crlf $+ $crlf did -a awaysys 23 Example Verbose: "UnderNet all". Will advertise your away messages on all channels on this particular network. $crlf $+ $crlf did -a awaysys 23 Example Verbose: "all #chan1 #chan2 #chan3". Will advertise your away messages on all networks on the channels specified. $crlf $+ $crlf did -a awaysys 23 Example Verbose: "all all". Will advertise your away messages on all networks and on all channels. $crlf $+ $crlf did -a awaysys 23 =========================[ CANCEL AWAY ]========================== $+ $crlf $+ $crlf did -a awaysys 23 Cancel away on activity - Anything you type, that is not a command and being away, will make you return from away. $crlf $+ $crlf did -a awaysys 23 ========================[ AWAY NICKNAMES ]========================= $+ $crlf $+ $crlf did -a awaysys 23 Away Nicknames: "Network <mainnick> <awaynick>" - to change nicknames when going away/coming back on these networks. $crlf $+ $crlf did -a awaysys 23 Example Nicknames: "mIRCScripts entropy entropy[a]". You cannot use "all" for away nicknames. $crlf $+ $crlf did -a awaysys 23 =========================[ SMART AWAY ]=========================== $+ $crlf $+ $crlf did -a awaysys 23 Smart Away - puts you as away when you type one of the following: "brb bbl afk bbiaf bbiab bbs" $crlf $+ $crlf did -a awaysys 23 ========================[ VERBOSE METHOD ]========================= $+ $crlf $+ $crlf did -a awaysys 23 Verbose Method - Uses either "action/message" for displaying away messages. $crlf $+ $crlf did -a awaysys 23 =========================[ AWAY NOTICES ]========================== $+ $crlf $+ $crlf did -a awaysys 23 Away Notices - sends a notice to all nicks that "highlight/PM/ctcp" you. $crlf $+ $crlf did -a awaysys 23 =======================[ AWAY NOTICE MESSAGE ]====================== $+ $crlf $+ $crlf did -a awaysys 23 Away Notice Message - If "Away Notices" is ticked, you will send a custom message to everyone who "highlights/PM/ctcp" you. $crlf $+ $crlf did -a awaysys 23 ===========================[ EOF ]=============================== } on *:dialog:awaysys:sclick:10:{ if (!$did(8,1).sel && $did(8).lines) { if ($input(Are you sure you want to delete all messages?,8,Delete)) { write -c awaymessages.txt | did -rz awaysys 8 } } else { var %a = 1 | while ($did(8,1).sel) { write $+(-dl,$did(8,1).sel) awaymessages.txt | did -dz awaysys 8 $did(8,1).sel | inc %a } } } on *:dialog:awaysys:sclick:21:{ %away_smart = $iif($did(21).state == 1,on,off) } on *:dialog:awaysys:sclick:14,15,22:{ %away_tab = $did } on *:dialog:awaysys:sclick:4:{ did -b awaysys 4 | did -c awaysys 4 | did -ue awaysys 5 | away $iif($did(2),$v1,No reason) } on *:dialog:awaysys:sclick:5:{ did -b awaysys 5 | did -c awaysys 5 | did -ue awaysys 4 | away } on *:dialog:awaysys:sclick:12:{ %away_cancel = $iif($did(12).state == 1,yes) } on *:dialog:awaysys:edit:6:{ .timeraway_idle -o 1 1 set %away_idle $iif($did(6),$v1,0) | scon -at1 .resetidle } on *:dialog:awaysys:sclick:13:{ if ($input(Are you sure you want to unload this script?,8,Confirm)) { .unload -rs $qt($script) } } on *:dialog:awaysys:edit:16:{ write -c awayverbose.txt | var %a = 1, %b, %to = $did(16).lines | while (%a <= %to) { %b = $did(16,%a).text | write awayverbose.txt $iif(%b,$v1,$crlf) | inc %a } | var %m = $read(awayverbose.txt,$lines(awayverbose.txt)) | if (!%m) { write $+(-dl,$lines(awayverbose.txt)) awayverbose.txt } } on *:dialog:awaysys:sclick:3:{ if ($did(3).state == 1) { %away_verbose = on } | else { %away_verbose = off } } on *:dialog:awaysys:sclick:18:{ if ($did(18).state == 1) { %away_nicks = on } | else { %away_nicks = off } } on *:dialog:awaysys:edit:19:{ write -c awaynicks.txt | var %a = 1, %b, %to = $did(19).lines | while (%a <= %to) { %b = $did(19,%a).text | write awaynicks.txt $iif(%b,$v1,$crlf) | inc %a } | var %m = $read(awaynicks.txt,$lines(awaynicks.txt)) | if (!%m) { write $+(-dl,$lines(awaynicks.txt)) awaynicks.txt } } on *:dialog:awaysys:sclick:17:{ if ($did(2).lines && $input(Are you sure you want to delete all away reasons?,8,Delete)) { write -c awayreasons.txt | did -r awaysys 2 } } on *:dialog:awaysys:sclick:24:{ %away_method = action } on *:dialog:awaysys:sclick:25:{ %away_method = message } on *:dialog:awaysys:sclick:27:{ %away_notices = $iif($did(27).state == 1,yes,no) } on *:dialog:awaysys:edit:29:{ %away_text = $did(29) } ;================================================================= ON TEXT EVENTS on *:open:?:*:{ if (%away_status == away && %away_notices == yes) { .timernoticenick -o 1 1 .notice $nick I am currently away: $_b($qt(%away_reason)) - Gone: $_b($_f) $iif(%away_text,- $v1) } } on *:text:*:?:{ if (%away_status == away) { var %m = $+([,$adate,]) $timestamp * $+([,$network,/PM]) $+(<,$nick,>) $strip($1-) write awaymessages.txt $unsafe( %m ) inc %away_msgs if ($dialog(awaysys)) { did -az awaysys 8 %m } } } on *:text:*:#:{ if ($istok($remove($strip($1-),~,&,@,%,+,!,?,$chr(44),.,:),$me,32) && %away_status == away) { if (%away_notices == yes) { $+(.timernoticenick,$nick) -o 1 1 .notice $nick I am currently away: $_b($qt(%away_reason)) - Gone: $_b($_f) $iif(%away_text,- $v1) } var %m = $+([,$adate,]) $timestamp * $+([,$network,/,#,]) $+(<,$nick,>) $strip($1-) write awaymessages.txt $unsafe( %m ) inc %away_msgs if ($dialog(awaysys)) { did -az awaysys 8 %m } } } ;================================================================= CTCP VERSION ctcp *:*:?:{ if ($1 == version) { .ctcpreply $nick VERSION Away System $sversion (https://mircscripts.info/fk1IK) - by $sauthor $syear } if (%away_status == away) { if (%away_notices == yes) { .timernoticenick -o 1 1 .notice $nick I am currently away: $_b($qt(%away_reason)) - Gone: $_b($_f) $iif(%away_text,- $v1) } var %m = $+([,$adate,]) $timestamp * $+([,$network,/CTCP,]) $+(<,$nick,>) $strip($1-) write awaymessages.txt $unsafe( %m ) inc %away_msgs if ($dialog(awaysys)) { did -az awaysys 8 %m } } } ;================================================================= RAWS raw 429:*:{ .timerawayflood -o 1 30 undo .timerfloodactivated -o 1 1 echomsg Too many aways - Flood Protection activated (expires: 30secs) unset %away_status %away_reason %away_gone .timerupdatethis off titlebar [HERE] if ($dialog(awaysys)) { dialog -t awaysys Away System $sversion - [HERE] all b did -c awaysys 5 did -u awaysys 4 did -u awaysys 2 } halt } raw 305:*:{ if (%away_reason) { .timerbackfromaway -o 1 1 echomsg You are back from: $_b($qt(%away_reason)) - Left: $_b($asctime(%away_gone,$remove($timestampfmt,[,]))) - Gone: $_b($_f) $iif(%away_msgs,- Messages: $_b(%away_msgs)) scon -at1 .resetidle verbose $iif(%away_method == message,I am back from:,is back from:) $_b($qt(%away_reason)) - Gone: $_b($_f) setnick main unset %away_msgs %away_status %away_reason %away_gone } halt } raw 306:*:{ if (%away_reason) { %away_gone = $calc($ctime + 1) .timerawayit -o 1 1 echomsg You are now away: $_b($qt(%away_reason)) - Left: $_b($asctime(%away_gone,$remove($timestampfmt,[,]))) verbose $iif(%away_method == message,I am now away:,is now away:) $_b($qt(%away_reason)) setnick away } halt } ;================================================================= EOF
Changelog:
V2.0 - (7/15/20)
- Removed the buggy update downloader
V1.9 - (7/8/20)
- Fixed an exploit with incoming away messages
V1.8 - (7/2/20)
- Fixed a blank away message bug
V1.7 - (6/28/20)
- Fixed the not working well auto away input (text)
v1.6 - (2-21-20)
- Some simple changes, nothing critical
v1.5 - (1-25-20)
- Fixed some annoyances
v1.4 - (1-19-20)
- Added "Away Notices" and "Away Notice Message"
v1.3 - (1-18-20)
- Added "Updater" and did some fixing of things
v1.2 - (1-17-20)
- Added "Smart Away" and "Verbose Method" and changed some stuff / improved some stuff
v1.1 - (1-15-20)
- Added tons of stuff and improved lots of stuff
v1.0 - (1-14-20)
- Initial release
V2.0 - (7/15/20)
- Removed the buggy update downloader
V1.9 - (7/8/20)
- Fixed an exploit with incoming away messages
V1.8 - (7/2/20)
- Fixed a blank away message bug
V1.7 - (6/28/20)
- Fixed the not working well auto away input (text)
v1.6 - (2-21-20)
- Some simple changes, nothing critical
v1.5 - (1-25-20)
- Fixed some annoyances
v1.4 - (1-19-20)
- Added "Away Notices" and "Away Notice Message"
v1.3 - (1-18-20)
- Added "Updater" and did some fixing of things
v1.2 - (1-17-20)
- Added "Smart Away" and "Verbose Method" and changed some stuff / improved some stuff
v1.1 - (1-15-20)
- Added tons of stuff and improved lots of stuff
v1.0 - (1-14-20)
- Initial release
Comments (2)