mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2004
Posts: 119
D
da_hype Offline OP
Vogon poet
OP Offline
Vogon poet
D
Joined: Feb 2004
Posts: 119
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
  }
}

Joined: Aug 2004
Posts: 237
L
Fjord artisan
Offline
Fjord artisan
L
Joined: Aug 2004
Posts: 237
only lists the channels of the active connection if i test it ?

Joined: Feb 2004
Posts: 119
D
da_hype Offline OP
Vogon poet
OP Offline
Vogon poet
D
Joined: Feb 2004
Posts: 119
yes

Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
What exactly do you want this alias to do? Like how should it display the channel list, etc..

Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
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.


New username: hixxy
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
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.

Last edited by DaveC; 16/01/05 12:56 AM.
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
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

Last edited by FiberOPtics; 16/01/05 03:06 AM.

Gone.
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
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))

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
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

Last edited by FiberOPtics; 16/01/05 07:19 AM.

Gone.
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
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


Link Copied to Clipboard