mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2003
Posts: 4
X
xtreme Offline OP
Self-satisified door
OP Offline
Self-satisified door
X
Joined: Jan 2003
Posts: 4
I am trying to put in my remotes to do the following:
on *CONNECT::?: { /j #channelname | /j #channelname }

When i connect to a server i am trying to make it join certain channels... i know the easy way would be to add this to the perform section of my script... but this is not what i want to do. Can someone help me out with the proper command format please? I am sure mine is not right since it is not working.
Thank you

Joined: Dec 2002
Posts: 40
C
Ameglian cow
Offline
Ameglian cow
C
Joined: Dec 2002
Posts: 40
here ya go

Code:
on 1:CONNECT: { /join #channel | /join #channel }


Coca-Bear

Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
Or just use a comma-delimited list of channels to join. laugh
Code:

on *:CONNECT: JOIN #channel1,#channel2,#channel3


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
Joined: Feb 2003
Posts: 76
G
Babel fish
Offline
Babel fish
G
Joined: Feb 2003
Posts: 76
Or even better make an autojoin list under %autojoin and add this to the remotes:
on 1:CONNECT: { j %autojoin }

also make 2 aliases:
j { join #$1 | if ($2) join #$2 | if ($3) join #$3..... }
autojoin { var %x | set %x $addtok(%autojoin,$1-,32) | set %autojoin %x }


...and you're O.K. cool

Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
That's true; I suppose you might want to make it slightly more complex to make managing the AutoJoin list(s) easier. The only problem with these aliases is that they do not provide a mechanism that would allow you to join a channel(s) with a key(s).
Code:

on *:CONNECT: .AutoJoin -n
alias J {
  if (!$1) .AutoJoin -n
  else {
    var %chans, %i = 1
    while ($gettok($1-, %i, 32)) {
      var %chan = $ifmatch
      if (#* !iswm %chan) %chan = $+($chr(35), %chan)
      %chans = $addtok(%chans, %chan, 44)
      if $numtok(%chans, 44) == 10 {
        .raw JOIN %chans
        %chans = $null
      }
      inc %i
    }
    if (%chans) .raw JOIN %chans
  }
}
alias AutoJoin {
  if $1 == -? {
    linesep -a
    echo $color(notice) -aqbflirt * USAGE: /AutoJoin [-?|-a|-c|-l|-n|-r] [[#]channel] [[#]channel]
    echo $color(notice) -aqbflirt *
    echo $color(notice) -aqbflirt * To rejoin all your AutoJoin channels:         /AutoJoin
    echo $color(notice) -aqbflirt * To get this help listing:                     /AutoJoin -?
    echo $color(notice) -aqbflirt * To add the active channel:                    /AutoJoin -a
    echo $color(notice) -aqbflirt * To clear all entries:                         /AutoJoin -c
    echo $color(notice) -aqbflirt * To list the current entries:                  /AutoJoin -l
    echo $color(notice) -aqbflirt * To join all your AutoJoin channels minimized: /AutoJoin -n
    echo $color(notice) -aqbflirt * To remove the active channel:                 /AutoJoin -ra
    echo $color(notice) -aqbflirt * To remove #HelpDesk and #Help:                /AutoJoin -r HelpDesk #Help
    echo $color(notice) -aqbflirt * To add #Help, #mIRC and #HelpDesk:            /AutoJoin Help #mIRC HelpDesk
    echo $color(notice) -aqbflirt *
    echo $color(notice) -aqbflirt * End of /AutoJoin -?.
    linesep -a
  }
  elseif $1 == -a && #* iswm $active {
    if (!$istok($eval($+(%, AutoJoin., $network), 2), $active, 44)) {
      set $+(%, AutoJoin., $network) $addtok($eval($+(%, AutoJoin., $network), 2), $active, 44)
      set $+(%, AutoJoin., $network) $sorttok($eval($+(%, AutoJoin., $network), 2), 44, r)
      echo $color(info) -eaqbflirt * AutoJoin: Added $active to list.
    }
    else echo $color(info) -eaqbflirt * AutoJoin: $active already in list.
  }
  elseif $1 == -c {
    unset $+(%, AutoJoin., $network)
    echo $color(info) -eaqbflirt * AutoJoin list cleared for $network $+ .
  }
  elseif $1 == -l {
    var %i = $numtok($eval($+(%, AutoJoin., $network), 2), 44)
    linesep -a
    while (%i) {
      echo $color(info) -aqbflirt $gettok($eval($+(%, AutoJoin., $network), 2), %i, 44)
      dec %i
    }
    echo $color(info) -aqbflirt End of /AutoJoin List.
    linesep -a
  }
  elseif $1 == -n JOIN -n $eval($+(%, AutoJoin., $network), 2)
  elseif $1 == -ra || $1 == -ar {
    if $istok($eval($+(%, AutoJoin., $network), 2), $active, 44) {
      set $+(%, AutoJoin., $network) $remtok($eval($+(%, AutoJoin., $network), 2), $active, 1, 44)
      echo $color(info) -eaqbflirt * AutoJoin: Removed $active from list.
    }
    else echo $color(info) -eaqbflirt * AutoJoin: Nothing to remove.
  }
  elseif $1 == -r {
    if !$2 {
      echo $color(info) -eaqbflirt * AutoJoin: Nothing to remove.
      halt
    }
    var %chans, %i = 1
    while ($gettok($2-, %i, 32)) {
      var %chan = $ifmatch
      if (#* !iswm %chan) %chan = $+($chr(35), %chan)
      if $istok($eval($+(%, AutoJoin., $network), 2), %chan, 44) {
        set $+(%, AutoJoin., $network) $remtok($eval($+(%, AutoJoin., $network), 2), %chan, 1, 44)
        %chans = $addtok(%chans, %chan, 32)
      }
      inc %i
    }
    if (%chans) echo $color(info) -eaqbflirt * AutoJoin: Removed %chans from list.
    else echo $color(info) -eaqbflirt * AutoJoin: Nothing to remove.
  }
  elseif $1 != $null && $left($1,1) != - {
    var %!chans, %chans, %i = 1
    while ($gettok($1-, %i, 32)) {
      var %chan = $ifmatch
      if (#* !iswm %chan) %chan = $+($chr(35), %chan)
      if (!$istok($eval($+(%, AutoJoin., $network), 2), %chan, 44)) {
        set $+(%, AutoJoin., $network) $addtok($eval($+(%, AutoJoin., $network), 2), %chan, 44)
        %chans = $addtok(%chans, %chan, 32)
      }
      else var -s %!chans = $addtok(%!chans, %chan, 32)
      inc %i
    }
    set $+(%, AutoJoin., $network) $sorttok($eval($+(%, AutoJoin., $network), 2), 44, r)
    if ($len(%!chans)) %!chans = $+([,%!chans already in list.])
    echo $color(info) -eaqbflirt * AutoJoin: Added %chans to list. %!chans
  }
  elseif $left($1,1) == - {
    linesep -a
    echo $color(notice) -aqbflirt * AUTOJOIN: Unknown parameter $1
    echo $color(notice) -aqbflirt *
    echo $color(notice) -aqbflirt * USAGE: /AutoJoin [ -l | -r | -c -? ] #[channel] #[channel]
    linesep -a
  }
  elseif ($eval($+(%, AutoJoin., $network), 2)) .raw JOIN $eval($+(%, AutoJoin., $network), 2)
  elseif (!$eval($+(%, AutoJoin., $network), 2)) echo $color(notice) -eaqbflirt $&
    * AutoJoin: No channels to auto-join on $network $+ .
}
menu channel {
  $iif($istok($eval($+(%, AutoJoin., $network), 2), $chan, 44), $style(1)) AutoJoin:{
    AutoJoin $iif($istok($eval($+(%, AutoJoin., $network), 2), $chan, 44),-ra,a)
  }
}

If you never auto-join channels that are keyed, then this will work wonderfully. It keeps each network's channel list in separate variable, as well. To really make the script relatively useful, you would probably need to keep track of keys for each channel, even if they're blank, as well as providing a way to alter just the key for each channel, manually and automatically.

The other consideration that was not accounted for is MaxChans since not all networks yet use the 005 numeric (MAXCHANNELS=40); also, each server on a network can have a different MAXCHANNELS, so unless you always connect to one server, your max might be different each time you connect. This script will just try to join as many as it can.

A dialog interface would also probably be helpful for those who are aliasly/menuly challenged and prefer a more visual user interface. The only two interfaces provided here are the channel popup to add/remove the active channel from the AutoJoin list and the over-blown /AutoJoin alias.

Still -- interesting to think about.


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
Joined: Feb 2003
Posts: 76
G
Babel fish
Offline
Babel fish
G
Joined: Feb 2003
Posts: 76
Yeah that would be nice, but I don't think i am a user that will understand all this code :P Your idea is good, thanks for it smile


Link Copied to Clipboard