AutoConnect Script

Moderator: GeekShed.Net Staff

AutoConnect Script

Postby Andrew12 » Fri Jan 15, 2010 11:14 pm

Decided to make an AutoConnect script today. Everything is explained within the file. Paste into remotes or download it to your $mircdir (//echo $mircdir - mine is C:\Documents and Settings\Andrew\Application Data\mIRC\), and then /load -rs it. It should be more-or-less self explanatory, and all of the directions are inside the file.

It can be found at http://blog.andrew12.net/autoconnect.txt, or below.
Code: Select all
; _______       _____      _________                              _____
; ___    |___  ___  /________  ____/________________________________  /_
; __  /| |  / / /  __/  __ \  /    _  __ \_  __ \_  __ \  _ \  ___/  __/
; _  ___ / /_/ // /_ / /_/ / /___  / /_/ /  / / /  / / /  __/ /__ / /_ 
; /_/  |_\__,_/ \__/ \____/\____/  \____//_/ /_//_/ /_/\___/\___/ \__/ 
;
;                                 by Andrew12
;
; Not entirely sure why I decided to put that there, anyways...
; Make sure you configure everything below.

on 1:start: {
  ;#####################
  ;# START CONFIGURING #
  ;#####################
  ; I would hope you know what a "nick" is, anick is the alternate one,
  ; the one that would be used if your first isn't available.

  set %auto.nick User
  set %auto.anick User|ghost

  ; Now for servers. server1 would be the first server you'd connect
  ; to, and server2 is the second, and so on. You can put the ports if
  ; you want to use SSL or something. If you want to connect to more
  ; servers, ask me, and I'll make it have more for you. If you need
  ; less, put a ; before the lines that don't have anything you need.

  set %auto.server1 irc.com
  set %auto.server2 irc.net
  set %auto.server3 irc.org
  set %auto.server4 irc.info
  set %auto.server5 irc.us

  ; Now for actually connecting... For "network1" you have to put the
  ; name of the network. For example, if you were doing GeekShed, you
  ; would put "GeekShed", not "irc.geekshed.net". For "password1", it
  ; would be your NickServ password for whatever you set network1 to.
  ; Repeat for network2-5. You don't have to put ; before networks
  ; you won't use.

  set %auto.network1 irccom
  set %auto.network2 ircnet
  set %auto.network3 ircorg
  set %auto.network4 ircinfo
  set %auto.network5 ircus

  set %auto.password1 supersecretpass123
  set %auto.password2 supersecretpass123
  set %auto.password3 supersecretpass123
  set %auto.password4 supersecretpass123
  set %auto.password5 supersecretpass123

  ; The channels. Set "channels1" to the channels you'd join, separated
  ; by commas. For example, if GeekShed was network1, and you wanted to
  ; join #chris, #bwanatv, and #theshed once you connected, you'd put
  ; "#chris,#bwanatv,#theshed" as channels1. Same with channels2 and
  ; so on.

  set %auto.channels1 #help,#chat
  set %auto.channels2 #help,#chat
  set %auto.channels3 #help,#chat
  set %auto.channels4 #help,#chat
  set %auto.channels5 #help,#chat

  ; That's all the configuration you should have to do for now.
  ; You probably shouldn't edit anything below this unless you
  ; know what you are doing.

  ;                  uuuuuuuuuuuuuuuuuuuu                                   
  ;                u" uuuuuuuuuuuuuuuuuu "u                                 
  ;              u" u$$$$$$$$$$$$$$$$$$$$u "u       
  ;            u" u$$$$$$$$$$$$$$$$$$$$$$$$u "u                             
  ;          u" u$$$$$$$$$$$$$$$$$$$$$$$$$$$$u "u                           
  ;        u" u$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$u "u                         
  ;      u" u$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$u "u                       
  ;      $ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $                       
  ;      $ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $                       
  ;      $ $$$" ... "$...  ...$" ... "$$$  ... "$$$ $                       
  ;      $ $$$u `"$$$$$$$  $$$  $$$$$  $$  $$$  $$$ $                       
  ;      $ $$$$$$uu "$$$$  $$$  $$$$$  $$  """ u$$$ $                       
  ;      $ $$$""$$$  $$$$  $$$u "$$$" u$$  $$$$$$$$ $                       
  ;      $ $$$$....,$$$$$..$$$$$....,$$$$..$$$$$$$$ $                       
  ;      $ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $                       
  ;      "u "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" u"                       
  ;        "u "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" u"                         
  ;          "u "$$$$$$$$$$$$$$$$$$$$$$$$$$$$" u"                           
  ;            "u "$$$$$$$$$$$$$$$$$$$$$$$$" u"                             
  ;              "u "$$$$$$$$$$$$$$$$$$$$" u"                               
  ;                "u """""""""""""""""" u"                                 
  ;                  """"""""""""""""""""               

  if (%auto.nick) nick %auto.nick
  if (%auto.anick) anick %auto.anick
  if (%auto.server1) server %auto.server1
  if (%auto.server2) server -m %auto.server2
  if (%auto.server3) server -m %auto.server3
  if (%auto.server4) server -m %auto.server4
  if (%auto.server5) server -m %auto.server5
}

on 1:exit: {
  unset %auto.nick
  unset %auto.anick

  unset %auto.server1
  unset %auto.server2
  unset %auto.server3
  unset %auto.server4
  unset %auto.server5

  unset %auto.network1
  unset %auto.network2
  unset %auto.network3
  unset %auto.network4
  unset %auto.network5

  unset %auto.password1
  unset %auto.password2
  unset %auto.password3
  unset %auto.password4
  unset %auto.password5

  unset %auto.channels1
  unset %auto.channels2
  unset %auto.channels3
  unset %auto.channels4
  unset %auto.channels5
}

on 1:notice:*choose a different nick*:*: {
  if ($nick == NickServ) {
    if ($network == %auto.network1) ns id %auto.password1
    if ($network == %auto.network2) ns id %auto.password2
    if ($network == %auto.network3) ns id %auto.password3
    if ($network == %auto.network4) ns id %auto.password4
    if ($network == %auto.network5) ns id %auto.password5
  }
}

on 1:notice:*you are now recognized*:*: {
  if ($nick == NickServ) {
    if ($network == %auto.network1) join %auto.channels1
    if ($network == %auto.network2) join %auto.channels2
    if ($network == %auto.network3) join %auto.channels3
    if ($network == %auto.network4) join %auto.channels4
    if ($network == %auto.network5) join %auto.channels5
  }
}


Tell me what you think!
Andrew12
 
Posts: 2
Joined: Mon Nov 09, 2009 8:13 pm

Re: AutoConnect Script

Postby Phil » Fri Jan 15, 2010 11:18 pm

Script is not particularly extensible for a general purpose script. Consider using a loop. It also insists that all networks you use run a services package with common output - some don't use services at all and common outputs are unheard of amongst service packages.

Phil
Phil
 
Posts: 142
Joined: Thu Oct 22, 2009 8:16 pm

Re: AutoConnect Script

Postby Phil » Fri Jan 15, 2010 11:34 pm

The following is more extensible. It's still not a very good way to do it - hash tables would be better and it doesn't well facilitate for channels with keys or large number of channels that will overflow the buffer.

Code: Select all
on 1:start: {
  ; Start of configuration
  set %auto.nick User
  set %auto.anick User|ghost

  set %auto.server.1 irc.com
  set %auto.server.2 irc.net
  set %auto.server.3 irc.org
  set %auto.server.4 irc.info
  set %auto.server.5 irc.us

  set %auto.network.1 irccom
  set %auto.network.2 ircnet
  set %auto.network.3 ircorg
  set %auto.network.4 ircinfo
  set %auto.network.5 ircus

  set %auto.password.1 supersecretpass123
  set %auto.password.2 supersecretpass123
  set %auto.password.3 supersecretpass123
  set %auto.password.4 supersecretpass123
  set %auto.password.5 supersecretpass123

  set %auto.channels.1 #help,#chat
  set %auto.channels.2 #help,#chat
  set %auto.channels.3 #help,#chat
  set %auto.channels.4 #help,#chat
  set %auto.channels.5 #help,#chat
  ; End of configuration
  ; Stop editing here

  if (%auto.nick) nick %auto.nick
  if (%auto.anick) anick %auto.anick
  if (%auto.server1) server %auto.server1
  if (%auto.server2) server -m %auto.server2
  if (%auto.server3) server -m %auto.server3
  if (%auto.server4) server -m %auto.server4
  if (%auto.server5) server -m %auto.server5
}

on 1:exit: {
  unset %auto.*
}

on 1:notice:*choose a different nick*:*: {
  set %auto.i 1

  while(%auto.network. $+ %auto.i) {
    if ($network == %auto.network. $+ %auto.i) {
      ns identify %auto.password. $+ %auto.i
    }

    inc %auto.i
  }

  unset %auto.i
  unset %auto.break
}

on 1:CONNECT:{
  set %auto.i 1
  set %auto.break 0

  while(%auto.network. $+ %auto.i) {
    if ($network == %auto.network. $+ %auto.i) {
      join %auto.channels. $+ %auto.i
    }
    else {
       set %auto.break 1
    }

    inc %auto.i
  }

  unset %auto.i
}
Phil
 
Posts: 142
Joined: Thu Oct 22, 2009 8:16 pm

Re: AutoConnect Script

Postby Andrew12 » Fri Jan 15, 2010 11:56 pm

Oh, that makes a lot more sense Phil. I didn't realize that on networks without services it won't be able to join any channels. The only reason I had it that way was because on some networks you won't get the access you have in said channel after identifying, because you're already in the channel... I guess if that happens to anyone, they'd just have to deal with it. :P

Also, I have no idea what hash tables are... though right after doing /help hash tables, I'm going to find out. :>
Andrew12
 
Posts: 2
Joined: Mon Nov 09, 2009 8:13 pm


Return to Script help

Who is online

Users browsing this forum: No registered users and 5 guests

cron