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?
Thank you! That worked wonderfully...
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()".
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 }.
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.
$(#,0) is a little bit faster than $chr(35) actually
You could save even another character by using a null second parameter: $(#,) :tongue:
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: