mIRC Home    About    Download    Register    News    Help

Print Thread
#163822 05/11/06 12:29 AM
Joined: Feb 2003
Posts: 105
L
Vogon poet
OP Offline
Vogon poet
L
Joined: Feb 2003
Posts: 105
The following works fine
Code:
 //say $asc(.) 

but this
Code:
 //say $asc(,) 
results in a 'Too many parameters: $asc' error.
Why is it so?

#163823 05/11/06 12:40 AM
Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
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"

#163824 05/11/06 01:14 AM
Joined: Oct 2005
Posts: 1,671
G
Hoopy frood
Offline
Hoopy frood
G
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

#163825 05/11/06 02:29 AM
Joined: Oct 2004
Posts: 8,061
R
Hoopy frood
Offline
Hoopy frood
R
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.

#163826 05/11/06 04:00 AM
D
DaveC
DaveC
D
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.

#163827 05/11/06 04:31 AM
Joined: Oct 2004
Posts: 8,061
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Oct 2004
Posts: 8,061
Quote:
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.

#163828 05/11/06 05:46 AM
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
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

#163829 05/11/06 05:59 AM
Joined: Oct 2005
Posts: 1,671
G
Hoopy frood
Offline
Hoopy frood
G
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

#163830 05/11/06 06:53 AM
Joined: Aug 2004
Posts: 7,168
R
Hoopy frood
Offline
Hoopy frood
R
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.

#163831 05/11/06 03:52 PM
Joined: Mar 2003
Posts: 611
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Mar 2003
Posts: 611
been posted before but heres mine...

Code:
 
alias ascii {  
  window -Ck0d @ascii-NUMBERS 372 1 265 700  
  var %f 1  
  while %f &lt; 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
#163832 05/11/06 06:26 PM
Joined: Oct 2005
Posts: 1,671
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,671
ASCII tables are not a unique thing:

http://www.google.com/search?q=ascii+table

-genius_at_work

#163833 05/11/06 10:52 PM
Joined: Oct 2004
Posts: 8,061
R
Hoopy frood
Offline
Hoopy frood
R
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. smile
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.

#163834 06/11/06 12:10 AM
Joined: Apr 2004
Posts: 755
M
Hoopy frood
Offline
Hoopy frood
M
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 smirk

#163835 06/11/06 04:46 AM
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
alias arc { // $+ $2- $asc($1) }

Syntax: CHR method of display

Example: , echo -a
Example: \ say
Example: [ msg #channel

#163836 04/12/06 05:33 AM
L
ldcrew
ldcrew
L
This is my little code:

Code:
 /asc { //echo -a $asc($$?="Ascii Conversion Enter Char") } 


works for single Chr

Joined: Sep 2005
Posts: 2,630
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,630
Code:
alias asc {
  bset -t &text 1 $1-
  echo -a $bvar(&text,1-)
}


/asc <string>


Link Copied to Clipboard