Connect event

By dataprofile on Sep 10, 2007

A connect snippet that utilizes a dialog and mirc's mirc.ini as a database for your default server, nick, alternative nick and password. You also have the option to auto-join channels and disable the auto-join feature when it is not wanted.

To change your default server: /paramsc.config server (new server)

dialog auto.con {
  title auto-connect options
  size -1 -1 99 97
  option dbu
  combo 1, 7 14 81 11, drop
  text "Server:", 2, 12 3 33 8
  list 3, 7 39 78 41, size
  button "+", 5, 24 81 20 12
  button "-", 6, 44 81 20 12
  menu "Nickname configuration", 7
  item "Default", 8, 7
  item "Alternative", 9, 7
  item "Password", 10, 7
}

on *:dialog:*:*:*:{
  var %x = 1
  if ($dname = auto.con) { 
    if ($devent = init) { 
      set %sclick 1
      did -a $dname 1 $readini(mirc.ini,Userprofiles,server) 
      did -b $dname 3,5,6
    }
    if ($devent = sclick) { 
      if ($did = 1) && (%sclick = 1) { 
        if ($readini(mirc.ini,Userprofiles,server)) {
          did -e $dname 3,5,6
          inc %sclick 1
          while (%x <= $lines(auto-joins.txt)) { 
            did -a $dname 3 $read(auto-joins.txt,%x) | inc %x
          }
        }
      }
      if ($did = 5) { 
        var %i = $$?="Enter channel to add."
        paramsc.config add chan %i
        did -a $dname 3 %i
      }
      if ($did = 6) { 
        if ($did($dname,3).sel) { 
          did -d $dname 3 $did($dname,3).sel
          paramsc.config rem chan $did($dname,3).sel
        }
      }
    }
    if ($devent = menu) { 
      if ($did = 8) { 
        writeini -n mirc.ini mirc nick $$?="Enter your main/default nickname."
      }
      if ($did = 9) { 
        writeini -n mirc.ini mirc anick $$?="Enter your alternative nickname"
      }
      if ($did = 10) { 
        writeini -n mirc.ini Userprofiles password $$?*="Enter password for your nick" 
      }
    }
    if ($devent = close) { 
      unset %sclick
    }
  }
}

raw 433:*Nickname is already in use*:{ 
  if ($1 !iswm $readini(mirc.ini,mirc,anick)) { 
    nick $readini(mirc.ini,mirc,anick) 
  }
}

on ^*:notice:*:*:{ 
  if ($nick = Nickserv) && (identify isin $1-) { 
    msg $nickserv $readini(mirc.ini,Userprofiles,password)
  }
}

on *:Connect:{ 
  var %x = 1
  while (%x <= $lines(auto-joins.txt)) {
    join $read(auto-joins.txt,%x) | inc %x 
  }
  if ($gettok($readini(mirc.ini,Userprofiles,auto-join),1,32) iswm active) {
    msg Nickserv identify $gettok($readini(mirc.ini,Userprofiles,password),1,32)
  }
}

alias paramsc.config {
  if ($1 = add) { 
    if ($2 = chan) { 
      if ( $read(auto-join.txt,$3) ) { echo $color(info) -a Invalid syntax: Channel $3 already exists. | halt }
      else { write auto-joins.txt $3 }
    }
    if ($2 = server) { 
      if ( $readini(mirc.ini,Userprofiles,server,$3) ) { echo $color(info) -a Invalid syntax: Server is already set as default. | halt }
      else { writeini mirc.ini Userprofiles server $3 }
    }
  }
  if ($1 = rem) { 
    if ($2 = chan) { 
      write -dl auto-joins.txt $gettok($read(auto-joins.txt, $3),1-,32) 
    }
    if ($2 = server) { 
      remini mirc.ini Userprofiles server 
    }
  }
}

Comments

Sign in to comment.
dataprofile   -  Sep 11, 2007

*updated:

dialoged and fixed errors.

 Respond  
dataprofile   -  Sep 11, 2007

Alright, I fixed the problem and ended up using a .txt file. Everything should be working now.

 Respond  
Olliegod   -  Sep 11, 2007
echo -a $color(info) Invalid syntax:

should be

echo $color(info) -a Invalid syntax:

And

 else { $addtok(%joins,$3,44)) }

won\'t do anything. It should be

else { set %joins $addtok(%joins,balls,44) }

Also your on connect event is very messed up, it puts mirc into a never ending loop of joining channels. If this code worked for you than I am very surprised, because this code does not look tested to me.

 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.