mIRC Home    About    Download    Register    News    Help

Print Thread
#209173 05/02/09 08:51 PM
Joined: Dec 2008
Posts: 95
A
Babel fish
OP Offline
Babel fish
A
Joined: Dec 2008
Posts: 95
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

asdfasdf #209174 05/02/09 08:57 PM
Joined: Nov 2008
Posts: 22
F
Ameglian cow
Offline
Ameglian cow
F
Joined: Nov 2008
Posts: 22
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.
asdfasdf #209175 05/02/09 08:59 PM
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
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.


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


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
qwerty #209215 06/02/09 07:59 PM
Joined: Dec 2008
Posts: 95
A
Babel fish
OP Offline
Babel fish
A
Joined: Dec 2008
Posts: 95
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,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
Does # work in a menu popup?

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

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


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"

Link Copied to Clipboard