mIRC Homepage
Posted By: asdfasdf $chan vs. # - 05/02/09 08:51 PM
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
Posted By: Firstmate Re: $chan vs. # - 05/02/09 08:57 PM
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.
Posted By: Tomao Re: $chan vs. # - 05/02/09 08:59 PM
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.

Posted By: qwerty Re: $chan vs. # - 05/02/09 09:38 PM
# and $chan are indeed evaluated the same way everywhere. Personally I use # just because it's shorter.
Posted By: asdfasdf Re: $chan vs. # - 06/02/09 07:59 PM
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
Posted By: DJ_Sol Re: $chan vs. # - 06/02/09 08:00 PM
Does # work in a menu popup?
Posted By: Tomao Re: $chan vs. # - 06/02/09 09:37 PM
As far as I know it does...
Posted By: argv0 Re: $chan vs. # - 07/02/09 01:36 AM
As noted, # is equivalent to $chan, so they work interchangeably regardless of context.
© mIRC Discussion Forums