Another Auto-Join

By Akishoot on Aug 30, 2007

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

Comments

Sign in to comment.
Hrki   -  Feb 15, 2011

Nice addon, but you should add network support

 Respond  
a careful warchild   -  Aug 15, 2008

excellent work akishoot

 Respond  
Akishoot   -  Oct 02, 2007

Edit: You no longer need to put the # before the channel name. Though if you do, it doesn\'t matter. (Thanks to Roy_ ;)

 Respond  
Roy_   -  Oct 02, 2007

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

 Respond  
Akishoot   -  Oct 02, 2007

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.

 Respond  
Roy_   -  Oct 02, 2007

Just change the $1 to $did(aj,2).text

--Roy

 Respond  
Roy_   -  Oct 02, 2007

It\'d probably be along the lines of: if ($left($1,1) iswm $chr(35))

--Roy

 Respond  
Akishoot   -  Oct 02, 2007

Not quite sure on how to get it to check to see if what you inputed begins with #. I\'m still fooling around with the dialog a bit...

 Respond  
Akishoot   -  Oct 02, 2007

Thanks for all the suggestions, mountaindew. I\'m working on those now, and a few other things. =)

 Respond  
guest598594   -  Oct 01, 2007

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
 Respond  
simplicity   -  Sep 30, 2007

Looks good.

 Respond  
Akishoot   -  Sep 29, 2007

Edit: I\'ve changed the .set %ajs and %ajd to var %ajs = 1 and var %ajd = 1. I\'ve also added an alias and it checks to see if the dialog is in use.

 Respond  
RubixCube   -  Sep 29, 2007

Pros:

  • efficient and easy to use
  • Original =)

Cons:

  • Setting unnecessary variables
  • Doesn\'t check if the the dialog is in use when opening.

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.

 Respond  
Akishoot   -  Aug 31, 2007

Thanks mountaindew :)

 Respond  
guest598594   -  Aug 31, 2007

Dizzle, you need 25 forum posts to rate snippets.

Akishoot, good job, very simple to use.

 Respond  
DizzIe   -  Aug 31, 2007

I wish I could rate. Why can\'t I rate yet? 0.o

 Respond  
DizzIe   -  Aug 31, 2007

Awesome script dude.

 Respond  
Akishoot   -  Aug 31, 2007

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

 Respond  
Akishoot   -  Aug 31, 2007

I\'ll get to work on it as soon as I can (that would be right now :P). Thanks for the suggestion! :)

 Respond  
Gummo   -  Aug 31, 2007

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. :)

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.