mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2021
Posts: 45
R
Robert Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Mar 2021
Posts: 45
How to rewrite this code to join each rooms every 10 seconds? Help me please
AutojoinChannels.txt like this:
#room1
#room2
#room3
.........
#roomN
I made this code because i can add new channels for MyBot to auto join newchannel by command: !autojoinchanadd #newchannel. Thanks all
Here is my code:
Code
on *:notice:*:?:{
  if ($regex($1-,/(.*AUTHENTICATION.*SUCCESSFUL.*)/Si) && $nick == X) {
    var %x = 1,%chans
    while (%x <= $lines(AutojoinChannels.txt)) {
      %chans = $addtok(%chans,$read(AutojoinChannels.txt,%x),44)
      inc %x
    }
    if (%chans) { .timer %chans }
  }
}

Joined: Jul 2006
Posts: 4,105
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,105
Code
on *:notice:*:?:{
  if ($regex($1-,/(.*AUTHENTICATION.*SUCCESSFUL.*)/Si) && $nick == X) {
    var %x = 1
    while (%x <= $lines(AutojoinChannels.txt)) {
      .timer 1 $calc(%x * 10) join $unsafe($read(AutojoinChannels.txt,tn,%x))
      inc %x
    }
  }
}


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Mar 2021
Posts: 45
R
Robert Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Mar 2021
Posts: 45
t's work exactly, perfect. Thanks Wins for your help!

Joined: Jan 2012
Posts: 275
Fjord artisan
Offline
Fjord artisan
Joined: Jan 2012
Posts: 275
Try using this code:
Code
on *:NOTICE:*:?:{
  if ($regex($1-,/(.*AUTHENTICATION.*SUCCESSFUL.*)/Si) && $nick == X) {
    var %i 1, %file AutojoinChannels.txt
    while (%i <= $lines(%file)) {
      var %str $read(%file,nt,%i)
      .timer $+ %str 1 $calc(%i * 10) join $unsafe(%str)
      inc %i
    }
  }
}


🌐 http://forum.epicnet.ru 📜 irc.epicnet.ru 6667 #Code | mIRC scripts, help, discuss, examples
Joined: Jan 2012
Posts: 275
Fjord artisan
Offline
Fjord artisan
Joined: Jan 2012
Posts: 275
Or you can try use this code, where the main function is made into a separate alias, and a unique name is added to each timer:
Code
on *:NOTICE:*:?: if ($regex($1-,/(.*AUTHENTICATION.*SUCCESSFUL.*)/Si) && $nick == X) { auto_join_channels }

alias auto_join_channels {
  var %i 1, %file AutoJoinChannels.txt
  while (%i <= $lines(%file)) {
    var %chan $read(%file,nt,%i)
    .timerAJC $+ %chan 1 $calc(%i * 10) join $unsafe(%chan)
    inc %i
  }
}


🌐 http://forum.epicnet.ru 📜 irc.epicnet.ru 6667 #Code | mIRC scripts, help, discuss, examples
Joined: Mar 2021
Posts: 45
R
Robert Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Mar 2021
Posts: 45
Very nice, it's work perfect.Thanks my best friend so much


Link Copied to Clipboard