mIRC AutoJoin Wizard

By Zmodem on Oct 16, 2008

This is a simple AutoJoin Wizard snippet for mIRC that will allow you to maintain a list of channels that you would like to autojoin on connect.

Included options for this snippet are: Specific networks to trigger the join for a certain channel, Performing commands when joining certain channels

Syntax: /ajwiz

Update 24 October 2008
» Fixed quotes not being able to be used in the commands.
» Fixed the ON JOIN commands not working properly in some instances.
» Fixed situations where the ON JOIN command was performing when anyone joined, not just yourself.

Image

alias -l ajwiz.rem remini $ajwiz.ini $1-
alias -l ajwiz.write writeini $ajwiz.ini $1-
alias -l ajwiz.i return $ini($ajwiz.ini,$1,$2)
alias -l ajwiz.ini return $qt($scriptdirajwiz.ini)
alias -l ajwiz.selnet return $did(ajwiz,3,$did(ajwiz,3).sel)
alias ajwiz dialog - $+ $iif($dialog(ajwiz),a,m ajwiz) ajwiz
alias -l ajwiz.selchan return $did(ajwiz,2,$did(ajwiz,2).sel)
alias -l ajwiz.selcmd return $did(ajwiz,12,$did(ajwiz,12).sel)
alias -l ajwiz.read if ($isfile($ajwiz.ini)) { return $readini($ajwiz.ini,$1,$2) }
alias -l ajwiz.load.channels {
  var %i = $ajwiz.i(channels,0), %a = did -a ajwiz 2
  did -r ajwiz 2
  did -b ajwiz 7
  while (%i) {
    %a $ajwiz.i(channels,%i)
    dec %i
  }
  did -b ajwiz 3,8,9,10,12,14,15,16
  did -r ajwiz 3,12
}
alias -l ajwiz.select.network {
  var %net = $did(ajwiz,3,$did(ajwiz,3).sel)
  if (%net) {
    did -e ajwiz 8,10
    ajwiz.write $ajwiz.selchan $+ Nets %net $did(ajwiz,3,$did(ajwiz,3).sel).cstate
  }
}
alias -l ajwiz.select.command {
  var %cmd = $ajwiz.selcmd
  if (%cmd) {
    did -e ajwiz 14,15
    ajwiz.write $ajwiz.selchan $+ Cmds $replace(%cmd,$chr(32),½,",µ) $did(ajwiz,12,$did(ajwiz,12).sel).cstate
  }
}
alias -l ajwiz.add.channel {
  var %i = $iif($1,$1,$input(Enter the name of a channel that you would like to add to the AutoJoin list. $+ $crlf $+ $crlf $+ (ie: #Blah),eio,Create New Entry)), %c
  if (%i) {
    %c = $remove($iif($left(%i,1) == $chr(35),%i,$chr(35) $+ %i),$chr(32))
    ajwiz.write Channels %c 1
    ajwiz.write %c $+ Nets All 1
    if ($dialog(ajwiz)) { ajwiz.load.channels }
  }
}
alias -l ajwiz.del.channel {
  if ($input(Are you sure that you want to remove this channel?,wy,Confirm Delete Channel)) {
    var %c = $ajwiz.selchan, %r = ajwiz.rem
    %r Channels %c
    %r %c $+ Nets
    %r %c $+ Cmds
    ajwiz.load.channels
  }
}
alias -l ajwiz.add.network {
  if ($input(Please enter a network mask to autojoin $+ $crlf $+ $crlf $+ (ie: *.dal.net or *.chatscape.net) $+ $crlf $+ $crlf $+ Try not to specify too many parameters unless you are sure of the entire network name.,ioe,Add New Network Mask)) {
    ajwiz.write $ajwiz.selchan $+ Nets $remove($v1,$chr(32)) 1
    ajwiz.load.networks
  }
}
alias -l ajwiz.del.network {
  ajwiz.rem $ajwiz.selchan $+ Nets $ajwiz.selnet
  ajwiz.load.networks
  if ($did(ajwiz,3).lines == 0) { did -b ajwiz 8 }
}
alias -l ajwiz.clear.networks {
  if ($input(Are you sure that you want to completely uncheck all of the networks?,wy,Confirm Network Clear)) {
    var %c = $ajwiz.selchan, %i = 1, %m = $ajwiz.i(%c $+ Nets,0), %a = did -l ajwiz 3, %aj
    while (%i <= %m) {
      %aj = $ajwiz.i(%c $+ Nets,%i)
      %a %i
      ajwiz.write %c $+ Nets %aj 0
      inc %i
    }
    did -b ajwiz 8,10
  }
}
alias -l ajwiz.load.networks {
  var %c = $ajwiz.selchan, %i = 1, %m = $ajwiz.i(%c $+ Nets,0), %a = did -a ajwiz 3, %k = did -s ajwiz 3, %aj
  did -r ajwiz 3
  if (%m) { did -e ajwiz 8 }
  while (%i <= %m) {
    %aj = $ajwiz.i(%c $+ Nets,%i)
    %a %aj
    if ($ajwiz.read(%c $+ Nets,%aj)) { %k %i }
    inc %i
  }
  did -e ajwiz 3,9
  did -b ajwiz 10
}
alias -l ajwiz.load.commands {
  var %c = $ajwiz.selchan, %i = 1, %m = $ajwiz.i(%c $+ Cmds,0), %a = did -a ajwiz 12, %k = did -s ajwiz 12, %aj
  did -r ajwiz 12
  if (%m) { did -e ajwiz 15 }
  while (%i <= %m) {
    %aj = $ajwiz.i(%c $+ Cmds,%i)
    %a $replace(%aj,½,$chr(32),µ,")
    if ($ajwiz.read(%c $+ Cmds,%aj)) { %k %i }
    inc %i
  }
  did -e ajwiz 12,16
  did -b ajwiz 14
}
alias -l ajwiz.add.command {
  if ($input(Enter a command you want to do once you've joined this channel:,ioe,Add New Command)) {
    ajwiz.write $ajwiz.selchan $+ Cmds $replace($v1,$chr(32),½,",µ) 1
    ajwiz.load.commands
  }
}
alias -l ajwiz.del.command {
  ajwiz.rem $ajwiz.selchan $+ Cmds $replace($ajwiz.selcmd,$chr(32),½,",µ)
  ajwiz.load.commands
  if ($did(ajwiz,12).lines == 0) { did -b ajwiz 15 }
}
alias -l ajwiz.clear.commands {
  if ($input(Are you sure that you want to completely uncheck all of the commands?,wy,Confirm Commands Clear)) {
    var %c = $ajwiz.selchan, %i = 1, %m = $ajwiz.i(%c $+ Cmds,0), %a = did -l ajwiz 12, %aj
    while (%i <= %m) {
      %aj = $ajwiz.i(%c $+ Cmds,%i)
      %a %i
      ajwiz.write %c $+ Cmds $replace(%aj,$chr(32),½,",µ) 0
      inc %i
    }
    did -b ajwiz 14,15
  }
}
alias -l connected.check.channels {
  var %c = $ajwiz.i(channels,0), %i = 1
  while (%i <= %c) {
    connected.check.nets $ajwiz.i(channels,%i)
    inc %i
  }
}
alias -l connected.check.nets {
  var %c = $1, %m = $ajwiz.i(%c $+ Nets,0), %i = 1, %h
  while (%i <= %m) {
    %h = $ajwiz.i(%c $+ Nets,%i)
    if ($ajwiz.read(%c $+ Nets,%h)) {
      if ((%h iswm $server) || (%h == All)) { join %c }
    }
    inc %i
  }
}
alias -l joined.channel.check.perform {
  var %c = $1, %m = $ajwiz.i(%c $+ Cmds,0), %i = 1, %h
  while (%i <= %m) {
    %h = $ajwiz.i(%c $+ Cmds,%i)
    if ($ajwiz.read(%c $+ Cmds,%h)) {
      $replace(%h,½,$chr(32),µ,")
    }
    inc %i
  }
}

dialog ajwiz {
  title "mIRC AutoJoin Wizard"
  size -1 -1 198 210
  option dbu
  box "Channels", 1, 3 3 78 183
  list 2, 7 11 69 153, size hsbar vsbar
  button "Add...", 6, 7 166 27 15
  button "Delete", 7, 48 166 27 15
  box "Specific Networks", 4, 84 3 111 94
  list 3, 88 13 102 60, size hsbar vsbar check
  button "Add Mask", 9, 89 78 27 15
  button "Delete", 10, 121 78 27 15
  box "", 5, 156 77 1 15
  button "Clear All", 8, 164 78 27 15
  box "Commands To Perform On Join", 11, 84 100 111 86
  list 12, 88 111 102 54, size hsbar vsbar check
  box "", 13, 156 166 1 15
  button "Delete", 14, 121 167 27 15
  button "Clear All", 15, 164 167 27 15
  button "New...", 16, 89 167 27 15
  button "Close", 17, 154 190 42 15, ok
  check "Enable The AutoJoin Wizard", 18, 3 192 75 12
}
ON *:DIALOG:ajwiz:*:*: {
  var %d = $dname, %e = $devent, %i = $did
  if (%e == init) {
    if ($group(#ajwiz).status == on) { did -c %d 18 }
    ajwiz.load.channels
  }
  if (%e == sclick) {
    if ((%i == 2) && ($did(2).sel)) { ajwiz.load.networks | ajwiz.load.commands | did -e %d 7 }
    if ((%i == 3) && ($did(3).sel)) { ajwiz.select.network }
    if (%i == 6) { ajwiz.add.channel }
    if (%i == 7) { ajwiz.del.channel }
    if (%i == 9) { ajwiz.add.network }
    if (%i == 8) { ajwiz.clear.networks }
    if (%i == 10) { ajwiz.del.network }
    if ((%i == 12) && ($did(12).sel)) { ajwiz.select.command }
    if (%i == 14) { ajwiz.del.command }
    if (%i == 15) { ajwiz.clear.commands }
    if (%i == 16) { ajwiz.add.command }
    if (%i == 18) { $iif($did(18).state,.enable,.disable) #ajwiz }
  }
}

menu menubar,status,channel {
  AutoJoin Wizard
  .$style($iif($group(#ajwiz).status == on,1)) Active:$iif($group(#ajwiz).status == on,.disable,.enable) #ajwiz
  .-
  .Configure:ajwiz
  .-
  .$iif(#,Add This Channel):ajwiz.add.channel # | return $input(# added to the autojoin list successfully!,io,Channel Added)
}
#ajwiz off
ON *:CONNECT:connected.check.channels
ON *:JOIN:#:if ($nick == $me) { joined.channel.check.perform # }
#ajwiz end

Comments

Sign in to comment.
Zmodem   -  Oct 24, 2008

Updated again. Hopefully I was able to find these errors before they plagued you, too :)

 Respond  
Zmodem   -  Oct 17, 2008

Thanks everyone! I may be updating it soon, just not sure what to add. Actually, I lie, I have an idea ;-)

 Respond  
fenix0r   -  Oct 17, 2008

isnt it the regular channel list is also the same?? i mean u can auto join, specific server, etc? but yeah...awesome job...

 Respond  
VryStrange   -  Oct 17, 2008

Works nice :)

 Respond  
EL   -  Oct 16, 2008

Nice Z.

 Respond  
Zmodem   -  Oct 16, 2008

Thanks for the good words, guys!

 Respond  
SuPeRFlY   -  Oct 16, 2008

Very nice. Works great so far.

 Respond  
_Daniel_   -  Oct 16, 2008

looks pretty good, good job.

 Respond  
^Neptune   -  Oct 16, 2008

Tried it, everything works nicely. Good job as usual ^_^. 8/10 from me.

 Respond  
Zmodem   -  Oct 16, 2008

A few minor issues were worked out at the last minute. They were basically just echo's that reported error-checking back to me. If you downloaded this earlier, please get it again for a cleaner version ;-) Thanks guys!

YES I KNOW THERE ARE ALREADY AUTOJOINS SUBMITTED. Thanks Sherlock!

 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.