mIRC Home    About    Download    Register    News    Help

Print Thread
list all servers, channels #208851 30/01/09 02:54 AM
Joined: Feb 2007
Posts: 234
M
MTec007 Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Feb 2007
Posts: 234
i have been trying to figure out how to list all connected servers and all channels i am currently in in each server.

eg;

network1
#chan1
#chan2
network2
#chan3
network3
#chan4

Re: list all servers, channels [Re: MTec007] #208857 30/01/09 05:34 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
This displays to you in your active window. If you want it else where, change the .echo to .msg <channel/nick>
Code:
alias list_all {
  .scon -at1 list_chan
}
alias list_chan {
  .echo -a $network
  var %a = 1, %b = $chan(0)
  while %a <= %b {
    echo -a $chan(%a)
    inc %a
  }
}

Re: list all servers, channels [Re: RusselB] #208859 30/01/09 06:50 AM
Joined: Feb 2007
Posts: 234
M
MTec007 Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Feb 2007
Posts: 234
that works great, thanks. But i am having problems now with the active connection (this does not have to do with your alias)

i want to return the active network. $me and $active return correctly but not $network i am using a regular set %var $network $me $active for this. what should i do for $network?

Last edited by MTec007; 30/01/09 06:51 AM.
Re: list all servers, channels [Re: MTec007] #208864 30/01/09 07:22 AM
Joined: Nov 2006
Posts: 1,559
H
Horstl Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
"Switch" your script to a particular connection (/scon and /scid commands) and execute commands on that connection, or use $scon() / $scid() identifiers and properties. Have a look at /help Multi-server smile

2 examples:
Code:
; if theres a Nth connection
if $scon(N) {
  ; switch to this connection (it's connection ID)
  scid $v1
  ; now you can do whatever you like - all identifiers etc are evaluated for this connection id
  echo -a Here on $network my nick is $me
  ; return to the current connection
  scon -r
}

Code:
if ($scon(1)) {
  echo -a Network 1 has connection ID $v1 . It's name is $scid($v1).network and my nick there is $scid($v1).me
}

Last edited by Horstl; 30/01/09 07:33 AM.
Re: list all servers, channels [Re: Horstl] #208865 30/01/09 07:32 AM
Joined: Feb 2007
Posts: 234
M
MTec007 Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Feb 2007
Posts: 234
How do i [/|$][scid|scon] to get $network without knowing what cid or con is active?

edit:
i missed another identifier, $activecid

echo -a Currently Active: $scid($activecid).network ( $+ $scid($activecid).me $+ ): $active

edit #2:
Why would this not be working (alias from above):

Code:
alias -l list_chan {
  set %fii %fii <b> $+ $network ( $+ $me $+ )</b><br>
  var %a = 1, %b = $chan(0)
  while %a <= %b {
    set %fii %fii --<b> $+ $chan(%a) $+ </b><br>---Topic: $chan(%a).topic $+ <br>---Mode: $chan(%a).mode $+ <br>---Key: $chan(%a).key $+ <br>---Limit: $chan(%a).limit $+ <br>---Users: $nick(%a,0,a) <b>(@: $nick(%a,0,o) $+ ;%: $nick(%a,0,h) $+ ;+: $nick(%a,0,v) $+ )</b> $+ <br><br>
    inc %a
  }
  ;echo -a %fii
  ;  return %fii
}


results:

---Users: (@: ;%: ;+: )

expected:

---Users: (@: 2;%: 0;+: 0)

Last edited by MTec007; 30/01/09 07:43 AM.
Re: list all servers, channels [Re: MTec007] #208866 30/01/09 08:01 AM
Joined: Nov 2006
Posts: 1,559
H
Horstl Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
$nick(%a,0,a) has to be $nick($chan(%a),0,a) etc

Re: list all servers, channels [Re: Horstl] #208867 30/01/09 08:05 AM
Joined: Feb 2007
Posts: 234
M
MTec007 Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Feb 2007
Posts: 234
* MTec007 can't beleive he missed that.

thats it, im tired. im going to get some rest. thank you for your help.

Re: list all servers, channels [Re: MTec007] #208869 30/01/09 08:43 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
You might also be interested in my Scrolling Titlebar snippet.