mIRC Home    About    Download    Register    News    Help

Print Thread
#209173 05/02/09 08:51 PM
A
asdfasdf
asdfasdf
A
Hi my dear mIRC friends,

I've got a quick question that has been bugging me for a while,
sorry if this was asked before, kinda hard to search for.

For retrieving the channel name for an event,
I used to use # for a long time but then started using $chan instead, probably just for consistency in the scripts.

Am I right when I assume that both # and $chan are always evaluated the same way and return the channel name,
or is there any difference between them?

What do you use yourself and why?


Thanks,
asdfasdf

#209174 05/02/09 08:57 PM
F
Firstmate
Firstmate
F
I believe # refers to the active channel, while $chan refers to the channel that triggered the script.

I may be wrong, so I'll let a more experienced scripter reply, but I believe that's the difference.

I use $chan, or at least a variable that contains the channel to minimize errors.

Last edited by Firstmate; 05/02/09 08:57 PM.
#209175 05/02/09 08:59 PM
Joined: Jul 2007
Posts: 1,124
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,124
According to mirc's help file, it says:

The # sign refers to the channel you are currently on. So if you are on channel #blah, and you type /p then mIRC replaces the # sign with #blah, and the final command is /part #blah.

So $chan and # are interchangeable in my opinion.


#209178 05/02/09 09:38 PM
Joined: Jan 2003
Posts: 2,125
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,125
# and $chan are indeed evaluated the same way everywhere. Personally I use # just because it's shorter.

qwerty #209215 06/02/09 07:59 PM
A
asdfasdf
asdfasdf
A
Well, alright then.

Thanks for your answers and the final clarification by qwerty (again).

So I'm probably just gonna get used to # again I think, even though I usually prefer consistency.

smile

qwerty #209216 06/02/09 08:00 PM
Joined: Jan 2007
Posts: 1,155
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,155
Does # work in a menu popup?

DJ_Sol #209219 06/02/09 09:37 PM
Joined: Jul 2007
Posts: 1,124
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,124
As far as I know it does...

DJ_Sol #209226 07/02/09 01:36 AM
Joined: Oct 2003
Posts: 3,641
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,641
As noted, # is equivalent to $chan, so they work interchangeably regardless of context.


Link Copied to Clipboard