Simple auto-join script with a dialog to manage networks and channels. This auto-join script lets you have different channels for different networks, because you don't obviously idle in the same channels on every network. I made this because I got lazy and didn't want to have to keep typing out '/join #channel.'
So I hope you all enjoy this simple and easy script. You just slap into your remotes and let it run. Right click anywhere and open Auto-Join Config.
Please rate, comment, criticize, and offer suggestions. Please if you leave a rating please do not leave unfair ratings. At least leave a comment explaining your rating.
/*
unRealIRC
Auto-Join Script
Scripted By: DarkWarrior
Version: 1.0
*/
dialog autojoin {
title "Auto-Join Configuration"
size -1 -1 176 81
option dbu
combo 1, 7 12 60 50, size drop
list 2, 77 12 60 50, size
button "Add", 3, 7 24 29 10
button "Delete", 4, 37 24 29 10
button "Add", 5, 140 21 29 10
button "Delete", 6, 140 37 29 10
check "Enable Auto-Join", 7, 8 48 58 10
text "Networks:", 8, 7 3 46 8
text "Channels:", 9, 76 3 37 8
button "Close", 10, 35 68 101 10, ok cancel
}
alias autojoin { dialog $iif($dialog(autojoin),-v,-md) autojoin autojoin }
menu * {
Auto-Join Config:autojoin
}
on *:start: {
.hmake autojoin 10
$iif($exists($qt($scriptdirautojoin.hsh)),hload autojoin $qt($scriptdirautojoin.hsh))
}
on *:exit: {
hsave autojoin $qt($scriptdirautojoin.hsh)
}
on *:dialog:autojoin:init:*: {
$iif(%autojoin.on,did -c $dname 7)
var %x = 1,%y = $hget(autojoin,0).item
while (%x <= %y) {
did -a $dname 1 $hget(autojoin,%x).item
inc %x
}
if ($hget(autojoin,$network).item) { did -c $dname 1 $findtok($didtok($dname,1,44),$network,1,44)
var %x = 1, %y = $numtok($hget(autojoin,$network),44)
while (%x <= %y) {
did -a $dname 2 $gettok($hget(autojoin,$network),%x,44)
inc %x
}
}
}
on *:dialog:autojoin:sclick:*: {
if ($did == 1) {
did -r $dname 2
var %x = 1, %y = $numtok($hget(autojoin,$did(1).seltext),44)
while (%x <= %y) {
did -a $dname 2 $gettok($hget(autojoin,$did(1).seltext),%x,44)
inc %x
}
}
if ($did == 3) {
var %input = $$input(Enter the network name displayed by '$network',eou,New Network,$network)
$iif($hget(autojoin,%input),noop $input(Error: Network $+(',%input,') already exists!,ouw,Error),hadd autojoin %input)
did -r $dname 1
var %x = 1,%y = $hget(autojoin,0).item
while (%x <= %y) {
did -a $dname 1 $hget(autojoin,%x).item
inc %x
}
did -c $dname 1 $findtok($didtok($dname,1,44),%input,1,44)
}
if ($did == 4) {
if ($did(1).seltext) {
hdel autojoin $v1
did -r $dname 1
var %x = 1,%y = $hget(autojoin,0).item
while (%x <= %y) {
did -a $dname 1 $hget(autojoin,%x).item
inc %x
}
did -c $dname 1 1
did -r $dname 2
var %x = 1, %y = $numtok($hget(autojoin,$did(1).seltext),44)
while (%x <= %y) {
did -a $dname 2 $gettok($hget(autojoin,$did(1).seltext),%x,44)
inc %x
}
}
}
if ($did == 5) {
if ($did(1).seltext) {
var %input = $$input(Enter the channel you would like to auto-join.,eou,New Channel)
$iif($findtok($hget(autojoin,$did(1).seltext),%input,1,44),noop $input(Error: Channel $+(',%input,') already exists!,ouw,Error),$iif($left(%input,1) == $chr(35),hadd autojoin $did(1).seltext $addtok($hget(autojoin,$did(1).seltext),%input,44),noop $input(Error: Channel $+(',%input,') is not a valid Channel. Must be in format: $+($chr(35),%input),ouw,Error)))
did -r $dname 2
var %x = 1, %y = $numtok($hget(autojoin,$did(1).seltext),44)
while (%x <= %y) {
did -a $dname 2 $gettok($hget(autojoin,$did(1).seltext),%x,44)
inc %x
}
}
}
if ($did == 6) {
if (($did(1).seltext) && ($did(2).seltext)) {
hadd autojoin $did(1).seltext $deltok($hget(autojoin,$did(1).seltext),$findtok($hget(autojoin,$did(1).seltext),$did(2).seltext,1,44),44)
did -r $dname 2
var %x = 1, %y = $numtok($hget(autojoin,$did(1).seltext),44)
while (%x <= %y) {
did -a $dname 2 $gettok($hget(autojoin,$did(1).seltext),%x,44)
inc %x
}
}
}
if ($did == 7) {
$iif($did(7).state == 1, set %autojoin.on on, unset %autojoin.on)
}
}
on *:connect: { if (%autojoin.on) { if ($hget(autojoin,$network)) { join $v1 } } }
nice work DarkWarrior, but maybe reline the dialog a bit to limit most of the unused space.
then again diff people have diff tastes in alignment.
also if you are going to go the route in using while loops. maybe instead of putting a while loop everywhere you need one in the snippet. make an alias then just make a call to that. if you understand what i mean.