mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Sep 2003
Posts: 7
S
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
S
Joined: Sep 2003
Posts: 7
I feel kinda silly, cuz this has been the most troublesome thing I've run into so far, but I'm trying to echo a # followed by a variable. I tried "echo # $+ %x" but that resulted in
#chan22 (where "#chan" is the channel I'm on and "22" is what's in the variable...)

Also tried escaping the # with a \, but that didn't work either.

Any suggestions?

Joined: Jun 2003
Posts: 242
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Jun 2003
Posts: 242
echo $+($chr(35),%x)

Joined: Sep 2003
Posts: 7
S
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
S
Joined: Sep 2003
Posts: 7
Thank you! That worked wonderfully...

Joined: Jun 2003
Posts: 242
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Jun 2003
Posts: 242
mp smile

Joined: Feb 2003
Posts: 810
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 810
You could also use "$(#)", which is smaller (and easier to read IMO); plus, this works with '{', '|' and '}' as well.
In case you don't know, "$()" is the same as "$eval()".


* cold edits his posts 24/7
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
That would be $(#,0). It's still shorter than $chr(35) by two chars, although I suspect a tiny bit slower too.

Also, $() doesn't work with { or } when they're alone. For some reason, $({) and $(}) return "0 0". Generally, preventing mirc from treating | as a special char is easier than with { or }.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Feb 2003
Posts: 810
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 810
Oops, that's me and my disadvantage of still using 5.91 and assuming it's the same way nowadays. $() must have been bugged or something, because it "works" here.


* cold edits his posts 24/7
Joined: May 2003
Posts: 161
A
Vogon poet
Offline
Vogon poet
A
Joined: May 2003
Posts: 161
$(#,0) is a little bit faster than $chr(35) actually

You could save even another character by using a null second parameter: $(#,) :tongue:

Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
I just benchmarked it and you're right. The difference is really really small (it took a 30000-iteration loop for a 'steady' difference of 10 msecs to emerge), but $(#,0) is faster indeed.

I like the $(#,) too :tongue:


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com

Link Copied to Clipboard