You've probably seen quite a few of these, and yes I know mIRC has it's own auto-join system. But I decided to make my own. :D
Right-click on the channel or go to the menubar and select Auto-Join :) Any comments or ideas would be fantastic! :)
Update 10/2/07: I condensed it a bit more and added a 'Clear' button for all the channels.
Update 5/8/08: Removed the use of a global variable to turn the auto-join on and off. It now uses $group() to check if the group is enabled or not. :)
alias a.join { if (!$dialog(aj)) dialog -md aj aj }
menu channel,menubar {
Auto-Join:a.join
}
dialog aj {
title "AJoin"
size -1 -1 150 345
option pixels
list 1, 19 122 112 164, size
edit "", 2, 18 36 112 20, autohs
text "Add Channel:", 3, 18 18 69 17
button "Add", 4, 26 95 42 17
button "Clear", 5, 78 95 42 17
button "Delete", 6, 21 288 48 22
check "Enable", 7, 84 323 55 17
box "", 8, 9 3 131 314
button "Close", 9, 15 321 62 19, ok
edit "", 10, 18 71 112 20
text "Key:", 11, 20 56 25 14
text "(if needed)", 12, 45 56 54 13, disable
button "Clear", 13, 78 288 48 22
}
on *:dialog:aj:*:*:{
if ($devent == sclick) {
if ($did == 13) {
.remove $network $+ .ajoin
did -r aj 1
}
if ($did == 4) {
if ($left($did(aj,2).text,1) != $chr(35)) {
write $network $+ .ajoin $chr(35) $+ $did(aj,2).text $did(aj,10).text
did -a aj 1 $chr(35) $+ $did(aj,2).text $did(aj,10).text
did -r aj 2,10
did -m aj 10
did -b aj 4,5
}
if ($left($did(aj,2).text,1) == $chr(35)) {
write $+($network,.,ajoin) $did(aj,2).text $did(aj,10).txt
did -a aj 1 $did(aj,2).text $did(aj,10).text
did -r aj 2,10
did -m aj 10
did -b aj 4,5
}
}
if ($did == 5) {
did -r aj 2,10
did -m aj 10
did -b aj 4,5
}
if ($did == 6) {
write -dl $did(aj,1).sel $network $+ .ajoin
did -d aj 1 $did(1).sel
}
if ($did == 7) {
$iif($group(#aj) == on,.disable #AJ,.enable #AJ)
}
}
if ($devent == edit) {
if ($did == 2) {
if ($did(aj,2).text != $null) {
did -e aj 4,5
did -n aj 10
}
if ($did(aj,2).text == $null) {
did -b aj 4,5
did -m aj 10
}
}
}
if ($devent == init) {
if ($did == 0) {
if ($group(#AJ) == On) { .did -c AJ 7 }
did -m aj 10
did -b aj 4,5
var %ajs = 1
while (%ajs <= $lines($network $+ .ajoin)) {
did -a aj 1 $read($network $+ .ajoin,%ajs))
inc %ajs 1
}
}
}
}
#aj off
on *:CONNECT:{
var %ajd = 1
while (%ajd <= $lines($network $+ .ajoin)) {
join $read($network $+ .ajoin,%ajd))
inc %ajd 1
}
}
#aj end
Or you could also try, I\'m a little fuzzy on this,
if ($left($did(aj,2).text,1) != $chr(35)) write $+($network,.,ajoin,.,txt) $+($chr(35),$did(aj,2).text) $did(aj,10).text
else { write $+($network,.,ajoin,.,txt) $did(aj,2).text $did(aj,10).txt }
Just in case someone makes a mistake, it already writes it for them.
--Roy
Edit: I\'ve disabled the second editbox and the \'Add\' and \'Clear\' button until you\'ve entered something into the first editbox. I\'ve yet to add the \'Clear All Channels\' button, which I\'ll be adding sometime soon.
I\'ll also be working on figuring something out for the \'Delete\' button and the # thing.
Suggestions:
*Add a clear all channels button
*I suggest you disable the add button until you typed in the edit box, and when theres nothing in it, disable it again
*Also, u might wanna disable the delete button until you click a channel
*Check if what you inputed begins with #
*Disable key until you type in a channel
on *:dialog:aj:sclick:5:{
did -ar aj 2
did -ar aj 10
}
*make it
did -r aj 2,10
Pros:
Cons:
Use local variables: var %ajs 1 and var %ajd 1. You can also create an alias that opens the dialog: alias aj.open { if (!$dialog(aj)) dialog -md aj aj } <- That\'s just an example. Sometimes it\'s easier to type the alias. On average, this is a really nice snippet. Good job.
Edit: The list is now saved as .ajoin so you don't accidently lose any channels you have saved.
There is now a Key option. I'm pretty sure you know what this is for. I realized shortly after posting that I couldn't join a channel because of the key :\
Each file is saved as $+ $network $+ .ajoin (Thanks Gummo! :D) so you can use it for multiple servers. I'm thinking about adding an Open/Load button so you can edit another servers channel list without actually connecting to that server. (Keyword: thinking :P)
Still working on it. Still looking for any comments/ideas :D
on *:CONNECT:{
set %con 1
while (%con <= $lines(ajoin.txt)) {
join $read(ajoin.txt,%con))
inc %con 1
}
}
You don\'t need to do that:
on *:CONNECT:.play -cs ajoin.txt
You could also expand this script by writing to a different filename for different networks (something like write ajoin. $+ $network $+ .txt $did(2) instead).
If you did that, you could make the connection part be something like this:
on *:CONNECT:.play -cs ajoin. $+ $network $+ .txt
Good idea, Akishoot. :)