Auto-identify/auto-join by Hermes v2

By Hermes on Apr 02, 2011

Screenshots

Hi, here's a simple auto-identify and auto-join :)
Press alt+r and paste the code into a new remote file.
Then, right click in channel or status and select Autoid/join.
Write your nick, your pass, comfirm your pass, your server adress, and your network (to know the network, just type in mIRC: //say $network).
Then, choose your channels and click on "add" to add them on auto-join (or "del" to delete them).
When it's done, just click on "ok" :)
Now, your mIRC will connect, identify and join all your channels everytime you will run mIRC.
Report any bug.

Hermes

[03/04/2011 update] Change "msg nickserv identify" to "ns identify" to be compatible with almost all the servers.
[06/04/2011 update] v2: Possibility to enable/disable the totality of the script with an "on/off" option.

menu * {
  Autoid/join : dialog -m idjoin idjoin
}

dialog idjoin {
  title "Auto-id/join by Hermes v2"
  size -1 -1 210 173
  option dbu
  box "Auto identify", 2, 10 11 190 50
  check "Enable auto-id", 3, 75 1 47 10 push
  check "Enable the Script", 69, 10 1 60 10 push
  text "Enter your nick:", 4, 73 18 42 8 
  edit "", 5, 73 26 54 10, disable
  text "Adress of server:", 6, 73 38 51 8
  edit "", 7, 73 46 54 10, disable
  text "Name of network:", 21, 16 38 51 8
  edit "", 22, 16 46 54 10, disable
  text "Enter your pass:", 8, 132 18 54 8
  edit "", 9, 132 26 54 10, disable pass
  text "Confirm your pass:", 10, 132 38 54 8
  edit "", 11, 132 46 54 10, disable pass
  button "Apply", 12, 21 23 37 14, disable
  box "Auto-join", 13, 10 63 190 86
  text "Your channels", 14, 32 72 37 8
  list 15, 32 80 59 61, size disable
  button "Add", 16, 92 89 27 12
  button "Delete", 17, 92 113 27 12
  text "Auto-join channels", 18, 120 72 46 8
  list 19, 120 80 62 61, size disable
  button "OK", 20, 84 154 40 15, ok
}

on *:dialog:idjoin:*:*:{
  if ($devent == init) {
    var %x = 1, %y = 1 
    if (%EnableAutoId == on) { did -c idjoin 3 | did -e idjoin 5,7,9,11,12,15,19,22 }
    if (%start == on) { did -c idjoin 69 } 
    did -r idjoin 15 | while (%x <= $chan(0)) { did -a idjoin 15 $chan(%x) | inc %x } 
    did -r idjoin 19 | while (%y <= $lines(AutojoinChannels.txt)) { did -a idjoin 19 $read(AutojoinChannels.txt,%y) | inc %y }
    did -a idjoin 5 %Nick | did -a idjoin 7 %Network | did -a idjoin 9 %Pass | did -a idjoin 11 %VerifPass | did -a idjoin 22 %NetworkName
  }
  if ($devent == sclick) {
    if ($did == 16) {
      var %y = 1
      write AutojoinChannels.txt $did(15,0).seltext
      did -r idjoin 19 | while (%y <= $lines(AutojoinChannels.txt)) { did -a idjoin 19 $read(AutojoinChannels.txt,%y) | inc %y }
    }
    if ($did == 17) {
      var %y = 1
      write -ds $+ $did(19,0).seltext AutojoinChannels.txt 
      did -r idjoin 19 | while (%y <= $lines(AutojoinChannels.txt)) { did -a idjoin 19 $read(AutojoinChannels.txt,%y) | inc %y }
    }
    if ($did == 3) {
      if ( $did(idjoin,3).state == 1 ) { did -e idjoin 5,7,9,11,12,15,19,22 | set %EnableAutoId on } 
      if ( $did(idjoin,3).state == 0 ) { did -b idjoin 5,7,9,11,12,15,19,22 | set %EnableAutoId off } 
    }
    if ($did == 12) { echo -a 4Changes made     
    }
    if ($did == 20) { echo -a 4,1Thanks for using 0Hermes script!   
    }
    if ($did == 69) {
      if ($did(idjoin,69).state == 1) { set %start on }
      if ($did(idjoin,69).state == 0) { set %start off }
    }
  }
  if ($devent == edit) {
    if ($did == 5) { set %Nick $did(5) }
    if ($did == 7) { set %Network $did(7) }
    if ($did == 9) { set %Pass $did(9) }
    if ($did == 11) { set %VerifPass $did(11) }
    if ($did == 22) { set %NetworkName $did(22) }
  }
}

on *:start:{
  if (%start == on) { server %Network | echo -a 9,1Auto-identify and auto-join by Hermes© }
}

on *:connect: {
  var %x = 1 
  if ($network == %NetworkName && %EnableAutoId == on) { nick %Nick | ns identify %Pass | while (%x <= $lines(AutojoinChannels.txt)) { join $read(AutojoinChannels.txt,%x) | inc %x }
  }
}

Comments

Sign in to comment.
Hermes   -  Apr 03, 2011

Thanks for the tips MaSOuD, Jethro_, Dean and jaytea, and thanks for the note Dean :)

 Respond  
_Dean_   -  Apr 03, 2011

so when its gonna be your last comment about my comment? cause you keep answering me

 Respond  
Jethro   -  Apr 03, 2011

That was my last comment in reply to your troll, not other people's comments. Now, please leave me be and be fed elsewhere.

 Respond  
_Dean_   -  Apr 03, 2011

i thought that was your last comment Jethro_, you cant keep your own word...

 Respond  
Jethro   -  Apr 03, 2011

Thanks jaytea. I do appreciate that you put this matter at bay with a thorough, humble explanation. ^^ I do hope we have more people like you, to encourage each other upon learning and take criticism as an incentive to strive for improvement, rather than stir something up for disharmony and refusing to swallow his or her darn pride for trivial matters.

 Respond  
jaytea   -  Apr 02, 2011

Or you could do it with the binary way:

this is a good idea and generally my method of choice, but what you have there won't quite work.

breplace &auto 13 44 10

this will certainly replace $chr(13) with $chr(44), but will do nothing with $chr(10)s since you haven't given it a byte value with which to replace them. modifying the width of a binary variable (for example, removing characters) isn't a trivial low level operation, and it's not something that is made possible with /breplace alone. so this snippet sends "JOIN #chan1,\n#chan2,\n#chan3,\n" to the server, which only succeeds in joining #chan1, but then throws errors "#CHAN2, Unknown command" and "#CHAN3, Unknown command" etc.

you can get around this by also replacing $chr(10) with a comma ('breplace &a 13 44 10 44') or forgoing /breplace altogether and using join $replace($bvar(&auto, 1-).text, $crlf, $chr(44)). the first option sends extraneous commas to the server, in between channels, which are safely ignored. the only conceivable drawback to sending these unnecessary commas is if it causes the length of the overall command to exceed the 512 byte limit imposed on the length of raw messages received by the server. but when's the last time you've send someone send such a long /join line? :P as for Dean's single extra comma, certainly not a bug since it doesn't alter the behaviour or results of the code, and it's an extremely unimportant detail at the end of the day.

 Respond  
_Dean_   -  Apr 02, 2011

as ever you're the only guy who starts the troll thing, i just gave another suggestion
you gave yours, about the binary variables, which is not necessary, since a $regsubex can do it
the comma in the end will not affect the code, and that line will only run in a on connect event, without affect nothing,
so i dont know why are you bothered with an extra comma

 Respond  
Jethro   -  Apr 02, 2011

Ok, I'm not going to debate this further with your persistent belief in having the comma...before this turns into another troll. This will be my last comment.

Look at it this way, both my example and MaSOuD's don't have the extra comma added at the end regardless of its workability. Why makes it unorthodox to be included? > and by the way, i dont need to give to you valid reasonsFor the record, there is none.

 Respond  
_Dean_   -  Apr 02, 2011

you can consider as "bug" something that will affect the code, itself, which not allow it to work correctly, the last comma will be ignored, and the command will work, so its not a bug

 Respond  
Jethro   -  Apr 02, 2011

While your common regex example is not considered a failure by design, it will look like a bug pestering the code when you can actually remove it.

 Respond  
_Dean_   -  Apr 02, 2011

Give me a valid reason why you need the last comma for the multiple join targets?

and why remove it, if it will not affect the code in nothing? you will only use it once, on connect, and the last comma will be ignored, so why remove it?

and by the way, i dont need to give to you valid reasons

 Respond  
Jethro   -  Apr 02, 2011

Give me a valid reason why you need the last comma for the multiple join targets?

 Respond  
_Dean_   -  Apr 02, 2011

your suggestion will just remove the last comma, which will be ignored, if there is no channel after this

 Respond  
Jethro   -  Apr 02, 2011
join $left($regsubex($str($chr(44),$lines(AutojoinChannels.txt)),//g,$read(file.txt,\n)),-1)
 Respond  
_Dean_   -  Apr 02, 2011

thanks for saying something that i already know, it will works, and cant be considered as fail, the command will be interpreted, and it will work

 Respond  
Jethro   -  Apr 02, 2011

Your regex example will output all the channels from the text file as

/join #chan1,#chan2,#chan3, with an extra comma at the end.

 Respond  
_Dean_   -  Apr 02, 2011

Hermes, you should do something to turn it off on start event
by the way, the on connect event can be done with the regsubex

join $regsubex($str($chr(44),$lines(AutojoinChannels.txt)),//g,$read(AutojoinChannels.txt,\n))

nice one 7/10

 Respond  
Jethro   -  Apr 02, 2011

Or you could do it with the binary way:

var %auto AutojoinChannels.txt
bread %auto 0 $file(%auto).size &auto
breplace &auto 13 44 10
join $bvar(&auto,1,$bvar(&auto,0)).text
 Respond  
MaSOuD   -  Apr 02, 2011

I think in the ON CONNECT event, you could do like this:

var %x = 1,%chans
while (%x <= $lines(AutojoinChannels.txt)) {
  %chans = $addtok(%chans,$read(AutojoinChannels.txt,%x),44)
  inc %x
}
if (%chans) { join %chans }

So, in this way you're just sending ONE command to join all the channels instead of sending one command per each channel.

Another suggestion: some networks/services are don't support /msg NickServ. Like DALnet; you must type /NickServ or /msg NickServ@services.dal.net... So, it's better to use /NickServ itself.

 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.