mIRC Homepage
Posted By: da_hype channels list in mult network - 15/01/05 09:56 PM
Is there a better/faster/shorter way to do this?

Code:
alias _mchan {
  var %a = 1,%c = 1
  while ($scon(%a)) {
    while ($chan(%c)) {
      echo -a $v1
      inc %c
    }    
    inc %a
  }
}
Posted By: LethPhaos Re: channels list in mult network - 15/01/05 10:25 PM
only lists the channels of the active connection if i test it ?
Posted By: da_hype Re: channels list in mult network - 15/01/05 10:36 PM
yes
Posted By: Iori Re: channels list in mult network - 15/01/05 11:51 PM
What exactly do you want this alias to do? Like how should it display the channel list, etc..
Posted By: tidy_trax Re: channels list in mult network - 16/01/05 12:30 AM
Code:
alias listchans { scon -at1 _listchans }
alias _listchans {
  var %i = 1 
  while ($chan(%i)) {
    echo -a $v1
    inc %i
  }
}


/_listchans - list channels on the active connection.
/listchans - list channels on all connections.
Posted By: DaveC Re: channels list in mult network - 16/01/05 12:53 AM
alias _mchan { scon -a var % $+ c = 1 $chr(124) while ($chan(%c)) $chr(123) echo -a $!v1 $chr(124) inc % $+ c $chr(125) }

if u want to reduce the code size.
Posted By: FiberOPtics Re: channels list in mult network - 16/01/05 01:23 AM
Hehe, I couldn't resist :tongue:

alias _mchan scon -at1 var $(%a = 1 |,) while $!chan(%a) $({ echo -a $v1,) $(| inc %a },)

But I must say, what you win in "less code" you lose in "readability".


This could also work:

alias _mchan tokenize 32 $dde($ddename,channels) | echo -a $*

However :

Not preferable as stated in the mIRC helpfile, and dde must be enabled of course. Another thing is, it displays ALL channels, including those where you are disconnected, and are still open.

Btw, I thought the DDE used to not work properly (spaces removed) on multiple connections, but after being on 3 diff networks at the same time, and in several channels, it still gave me the channels nicely, delimited by spaces.

I think what tidy gave would be best.

Greets
Posted By: DaveC Re: channels list in mult network - 16/01/05 07:14 AM
lol this relates directly to a post i just made to u infact.
In that one i uses _ not $chr(160)

Readability it is then smile

Code:
alias _mchan scon -at1 $replace(    var %a = 1 | while $chan(%a) { echo -a $v1 | inc %a }   , $chr(160), $chr(32))
Posted By: FiberOPtics Re: channels list in mult network - 16/01/05 07:18 AM
Yeah,

that was the reason why I made that suggestion actually.

If I have to be honest, I think $chr(160) is even worse than _, because people who copy the code (and don't know how it works exactly), might just think that the copying put extra spaces. The moment they remove one of those hard spaces, the code fails.

Btw I didn't remove spaces, and I already get invalid format replace :tongue:

Greets
Posted By: DaveC Re: channels list in mult network - 16/01/05 07:35 AM
lol thats what i get for being a smartypants using 160's,

$replace( _var_%a_=_1_|_while_$chan(%a)_{_echo_-a_$v1_|_inc_%a_} ,_,$chr(32))

worked

Actually i just checked my code, its the message board, it converted the 160's to spaces i think.

Yes i agree 160's are bound to cause lifes little horrors

I remember mine i was comparing text and couldnt work out why AB C != AB C
© mIRC Discussion Forums