mIRC Home    About    Download    Register    News    Help

Print Thread
#124158 03/07/05 07:02 AM
Joined: Apr 2004
Posts: 218
P
Fjord artisan
OP Offline
Fjord artisan
P
Joined: Apr 2004
Posts: 218
Maybe a .chans prop for $scon() ?

Would return the channels that you're currently in.

Example:
$scon(1).chans = #chan1 #chan2 #star #promo #ptco
$scon(2).chans = #serverhcan2 #chat #lobby

Etc?

For now?:
Code:
chans {
  var %i 1,%c
  while (%i <= $chan(0)) {
    %c = $addtok(%c, $+ $chan(%i),32)
    inc %i
  }
  return %c
}


Live to Dream & Dream for Life
#124159 03/07/05 07:49 AM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
How about..

Code:
alias chans {
  if (!$scon($1)) return
  if ($1 == 0) return $scon(0)
  var %x = $chan(0), %chans
  while (%x) { 
    %chans = $addtok(%chans,$chan(%x),32)
    dec %x
  }
  scon $1 return $scon($1).server %chans
}


$chans(0) returns $scon(0) evaluated. If $scon(N) is null it returns $false, otherwise lists all channels on that connection.

//echo -a $scon(1) lists all channels on first connection.

It's rather brief.

-Andy

#124160 03/07/05 08:08 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
ok i seen things like this before, and well ask as i dont see any difference

Whats the reason/advantage in using $addtok (knowing that you cant have a duplicate anyway)

%chans = $addtok(%chans,$chan(%x),32)
verses
%chans = %chans $chan(%x)

?

#124161 03/07/05 03:39 PM
Joined: Apr 2004
Posts: 218
P
Fjord artisan
OP Offline
Fjord artisan
P
Joined: Apr 2004
Posts: 218
I have no reason really. Sameway but different o.o


Live to Dream & Dream for Life

Link Copied to Clipboard