mIRC Home    About    Download    Register    News    Help

Print Thread
#234851 12/11/11 11:22 PM
E
eawedat
eawedat
E
hey all,

what's wrong with typing :
Code:
//echo $asc(65)


in the editbox?

/echo: insufficient parameters

thanks.

#234853 13/11/11 12:24 AM
Joined: Jul 2007
Posts: 1,124
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,124
You missed the -a switch:
//echo -a $asc(65)

#234854 13/11/11 01:02 AM
Joined: Oct 2004
Posts: 8,061
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Oct 2004
Posts: 8,061
Why are you using $asc() with a number? Perhaps you meant $chr() ?

$asc() is used with a single character inside the parentheses. It will then tell you the $chr() value of that character. $chr() is the opposite. It will tell you the single character for the number value you enter:

//echo -a $chr(65)
A

//echo -a $asc(A)
65

Riamus2 #234860 13/11/11 08:23 AM
E
eawedat
eawedat
E
I know that "-a" option means to echo in active window!

but if i'm already in an active window why should I type it?
By the way it is interesting why $chr(65) DOES work without adding the option "-a".

Code:
//echo $chr(65) 


would echo normally the character "A".

-------------------------------------------------
Riamus2 , i'm just reviewing some built-in functions for a project!

thanks a lot guys.

#234861 13/11/11 08:34 AM
Joined: Jul 2007
Posts: 1,124
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,124
From my experience, some identifiers require that you include the -a switch to be evaluated properly with the echo command via the edit box. For $asc() identifier, it needs -a, otherwise you'll get an error. For $chr(), though, it doesn't. There has to be a good explanation for this matter, but I'm not certain.

Tomao #234862 13/11/11 08:49 AM
E
eawedat
eawedat
E
Tomao, I see, is there a list for example that indicates which command has to include -a and which not?

#234865 13/11/11 09:28 AM
Joined: Oct 2003
Posts: 3,641
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,641
You should read the /help for every command you use. That said, you'll probably only run into this problem with /echo.

#234872 13/11/11 02:24 PM
Joined: Oct 2004
Posts: 8,061
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Oct 2004
Posts: 8,061
It's usually a good idea to just be in the habit of including the location you want the echo to appear no matter what you're doing, whether that means including -a or -s or a window name. If you're in the habit of always including the location, then you won't run into these types of problems.

As to why there is an issue with $asc()... it's because you're getting a numerical value and a number after /echo is treated as part of the command. You can see that by just using:
/echo 1

Use /help /echo and you'll understand why a number is part of the command.

Riamus2 #234894 14/11/11 09:34 AM
E
eawedat
eawedat
E
by the way you could type any "char" to let echo work with $asc or other functions. it is not only "-a".

for example you could type.
Code:
//echo x $asc(65)
//echo - $asc(65)
//echo . $asc(65)
//echo 4 $asc(65)


thanks.

#234897 14/11/11 11:16 AM
Joined: Oct 2004
Posts: 8,061
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Oct 2004
Posts: 8,061
Non-numerical text functions like you'd expect. It will display fine. As I stated, only a number will have problems if you don't include a location. Notice in your last example that the 4 is not shown. A number is part of the command if no location is given before it. If you have nothing after the number, it will give an error because there isn't anything to display. If something is after it, the text will display, but the number will not. It's the color. As I said, read the help file for /echo and it makes sense why it works that way.

And you really need to get rid of the 65 in $asc(). If you want the value from "6", then use $asc(6). Anything following the first character in $asc() is ignored. The result for $asc(6) is the same as for $asc(65) or $asc(60279357823682368972357325) or $asc(6kjasfj32t50jsldkjf345) or whatever else. 65 has no meaning in $asc().


Link Copied to Clipboard