mIRC Home    About    Download    Register    News    Help

Print Thread
#38060 23/07/03 04:02 PM
Joined: Apr 2003
Posts: 210
S
saxon Offline OP
Fjord artisan
OP Offline
Fjord artisan
S
Joined: Apr 2003
Posts: 210
//echo -a $chan(fsdfsdljfakjglkfdjglkdjgldfgfdsfafsdfsdf)

Should return * /echo: insufficient parameters

However it returns: 1

#38061 23/07/03 04:18 PM
Joined: Dec 2002
Posts: 127
F
Vogon poet
Offline
Vogon poet
F
Joined: Dec 2002
Posts: 127
umm.. it returns "0" for me (6.03).


------
deep down, i'm really superficial.
#38062 23/07/03 05:06 PM
Joined: Apr 2003
Posts: 210
S
saxon Offline OP
Fjord artisan
OP Offline
Fjord artisan
S
Joined: Apr 2003
Posts: 210
Im using WinXP pro, mIRC 6.03 and it returns 1.

Also, //echo -a $isalias(chan) returns $false, before anyone asks.

#38063 23/07/03 05:35 PM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
It returns the number of channels you are currently on, not sure why it does this, but that explains why some see a 0 and some see a 1. Try joining another channel and you'll see it then returns 2.

#38064 23/07/03 05:45 PM
Joined: Apr 2003
Posts: 210
S
saxon Offline OP
Fjord artisan
OP Offline
Fjord artisan
S
Joined: Apr 2003
Posts: 210
Your right. I was trying to use it as a way of determing if the active window is a channel i'm in. Like:
if ($chan($active)) { commands }

Because if for example your in channel #test, and type:
//echo -a $chan(#test), it returns: #test

So i assumed if I wasn't in the specified channel it should return $null. Oh well, guess I will have to use a loop or some other method.

#38065 23/07/03 05:51 PM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
It's not a bug. You already know that $chan(N) returns the Nth channel, if N is a number greater than 0. If it's zero or a non-numeric string the first character of which is not in $chantypes, it returns the total number of channels (if N is a string that begins with one of the chars in $chantypes, mirc returns the channel name if you are on that channel, otherwise $null). So, if you are on #foo and #bar and $chantypes for that network returns "#&":
$chan(#foo) returns #foo
$chan(#mirc) returns $null
$chan(&mirc) returns $null
$chan(+mirc) returns 2
$chan(foo) returns 2

Many mirc identifiers do the same thing, fex, $gettok(a b c,a,32), $line(status window,a), a fact that suggests this is intentional.

Edit: and once more, somebody sneaked in an posted while I was previewing my post...

Last edited by qwerty; 23/07/03 05:54 PM.

/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
#38066 23/07/03 05:55 PM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
You can use $window($active).type


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
#38067 23/07/03 06:08 PM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Yeah thats the way it seems to work, however I can't seem to find anything in the helpfile that says that's how it is supposed to work. All I see is:
If you specify a channel name, information on that channel is returned but only if you are on that channel already.

Doesn't say "if you specify something that isn't a valid channel name, then the total number of channels you are on is returned"

#38068 23/07/03 07:41 PM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
if ($chan)

or

if ($active ischan)

or

if ($window($active).type == channel)

or

var %re = /^[ $+ $chantypes $+ ].+$/
if ($regex($active, %re))

There are obviously lots more ways to do this if you start getting into multiple if conditions and checking for valid values in the channel name.


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C

Link Copied to Clipboard