|
Joined: Feb 2003
Posts: 105
Vogon poet
|
OP
Vogon poet
Joined: Feb 2003
Posts: 105 |
The following works fine but this results in a 'Too many parameters: $asc' error. Why is it so?
|
|
|
|
Joined: Dec 2002
Posts: 1,245
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,245 |
because mIRC uses , as a special character the characters such as the comma, braces () {} and so on will produce error results of one or another because mIRC is expecting some other info there, $asc(,) makes mIRC think you are supplying more than one parameter in the identifier rather than seeing your request as "the number for the comma character"
|
|
|
|
Joined: Oct 2005
Posts: 1,671
Hoopy frood
|
Hoopy frood
Joined: Oct 2005
Posts: 1,671 |
If you just want to retrieve the chr value of characters, you can use this code:
//say $asc($?)
Enter any single character in the input dialog, and the chr value will be msg'd to your channel. Only the first character is displayed.
-genius_at_work
|
|
|
|
Joined: Oct 2004
Posts: 8,061
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,061 |
Wasn't there a method to escape those so you could get them displayed without using an input dialog or similar method? I've tried a variety of placements of ! in there and can't get it to work.
|
|
|
|
DaveC
|
DaveC
|
What would be the purpose of it being escaped?
Assuming \\, escaped , why put $asc(\\,) when you could just put 44 in place of the lot.
I see no problem with the small level of limitations placed on $asc in this sence, becuase you really just dont need to be evaluating constants, you should just get the value and use it, now if its a dynamic string containing "," then $asc well work fine of course.
|
|
|
|
Joined: Oct 2004
Posts: 8,061
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,061 |
why put $asc(\\,) when you could just put 44 in place of the lot. To find out what the $chr is for it. Obviously, if you know the $chr number, you don't need to worry about it. And, yes, I know comma is 44. However, there are times when I have to figure out some of the others that I rarely use $chr for and $asc won't give me an answer. I suppose I could just create a list somewhere and when I come across the need for them, I'd just look on the list, but I like being able to just use //echo -a $asc(N) to get the value for N. And I thought I had seen something on this forum about how to do that. Just don't remember it anymore and wouldn't have any idea what to search for to find it again.
|
|
|
|
Joined: Aug 2005
Posts: 1,052
Hoopy frood
|
Hoopy frood
Joined: Aug 2005
Posts: 1,052 |
just create a large chr list for reference...
alias crCHR { var %x = 1 while (%x <= 300) { write charmap.txt $+(CHR,[,%x,]) = $chr(%x) inc %x } }
basically this will write to file charmap.txt when and only after you have typed /crchr in mIRC go view your subfolder by either typing //run . or //run $mircdir and find the charmap.txt this will it will tell you which $chr number ='s what
|
|
|
|
Joined: Oct 2005
Posts: 1,671
Hoopy frood
|
Hoopy frood
Joined: Oct 2005
Posts: 1,671 |
I don't think there is any way to not evaluate a literal comma in an identifier. Or at least I couldn't find one. Other than the method above, here is another way:
//set -u %c , | echo -a $asc(%c)
Or you could make a custom identifier:
alias getasc echo -a $asc($1)
/getasc , /getasc (
-genius_at_work
|
|
|
|
Joined: Aug 2004
Posts: 7,168
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,168 |
1) No need to go to 300, since the maximum number of ascii characters is 256 (character codes 0 - 255)
There are some codes that will not write properly examples:$chr(3) - Ctrl +K $chr(10) - Line feed $chr(13) - Return/Enter key
Those are one's I run across many times, so I have them memorized. I also have (or had) a chart that showed all of the ascii codes and what they correspond to. I'll see if I can find it, get it scanned, and post it via ImageShack for anyone to reference.
|
|
|
|
Joined: Mar 2003
Posts: 611
Fjord artisan
|
Fjord artisan
Joined: Mar 2003
Posts: 611 |
been posted before but heres mine...
alias ascii {
window -Ck0d @ascii-NUMBERS 372 1 265 700
var %f 1
while %f < 257 {
if %f == 2 { echo @ascii-NUMBERS $chr(%f) - alt + 0 $+ %f (CTRL + B) }
elseif %f == 3 { echo @ascii-NUMBERS $chr(%f) - alt + 0 $+ %f (CTRL + K) }
elseif %f == 15 { echo @ascii-NUMBERS $chr(%f) - alt + 0 $+ %f (CTRL + O) }
elseif %f == 022 { echo @ascii-NUMBERS $chr(%f) - alt + 0 $+ %f (CTRL + R) }
elseif %f == 031 { echo @ascii-NUMBERS $chr(%f) - alt + 0 $+ %f (CTRL + U) }
elseif %f == 032 { echo @ascii-NUMBERS $chr(%f) - alt + 0 $+ %f (SPACE) }
elseif %f == 0160 { echo @ascii-NUMBERS $chr(%f) - alt + 0 $+ %f ("HARD SPACE") }
else echo @ascii-NUMBERS $chr(%f) - alt + 0 $+ %f
inc %f
}
}
billythekid
|
|
|
|
Joined: Oct 2004
Posts: 8,061
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,061 |
Not replying to anyone in particular.... 1) I know I could do an ascii table, but I don't want to.  2) I know about doing it as an alias, and that works fine, but it's still a bit of a pain. Anyhow, I was sure I'd seen a way to do it with just $asc before on this forum, but I forget how, now. Oh, well.
|
|
|
|
Joined: Apr 2004
Posts: 755
Hoopy frood
|
Hoopy frood
Joined: Apr 2004
Posts: 755 |
Always have this alias loaded: /asc bset -t &asc 1 $$1- | echo -a $qt($1-) = $bvar(&asc,1-) since i often need to know more then one ascii value I never seen a way to do $asc(,) directly though 
|
|
|
|
Joined: Aug 2005
Posts: 1,052
Hoopy frood
|
Hoopy frood
Joined: Aug 2005
Posts: 1,052 |
alias arc { // $+ $2- $asc($1) }
Syntax: CHR method of display
Example: , echo -a Example: \ say Example: [ msg #channel
|
|
|
|
ldcrew
|
ldcrew
|
This is my little code: /asc { //echo -a $asc($$?="Ascii Conversion Enter Char") } works for single Chr
|
|
|
|
Joined: Sep 2005
Posts: 2,630
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,630 |
alias asc {
bset -t &text 1 $1-
echo -a $bvar(&text,1-)
}
/asc <string>
|
|
|
|
|