mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jul 2006
Posts: 4,145
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
1) When you trying to stick some text with $N like $1's, if text contain number, mirc cut the text :

Code:
//tokenize 32 Ga is Ga | echo -a $1_some_text /// $1_some1text


2) There is another strange thing :

Code:
//Echo -a $mid(text,1,2)Ga


This will echo "te" but i think it should return $mid(text,1,2)Ga since the $mid shouln't be evaluate and here :
Code:
//echo -a Ga$mid(text,1,2)

the $mid isn't evaluate.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
I think the second thing you've shown should give an error.

Joined: Jul 2006
Posts: 4,145
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
Why ? this can be reproduced with any $identifier that use bracket ().

Code:
$mid(text,1,2)Ga

Where is the error ?


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
Originally Posted By: Wims

Code:
//Echo -a $mid(text,1,2)Ga

This will echo "te" but i think it should return $mid(text,1,2)Ga

It's returning "te" as mIRC evaluates the $mid* thingie (you're using "//" in your echo command). If you want it to return "$mid(text,1,2)Ga", use /echo, not //echo.

But I think this should return an error, too:
Everything appending a text token identifier (don't know how to call this, like the example "$1's") is appended, but not everything appending the return of an alias/command, like $mid().
"$me's" never worked: how shall mIRC now whether to call "$me" and append "'s", or call a custom alias named "$me's"
The return of a nonexistent alias is $null, and //echo -a $null returns an error: * /echo: insufficient parameters smile

Joined: Jul 2006
Posts: 4,145
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
Quote:
It's returning "te" as mIRC evaluates the $mid part (you're using "//" in your echo command). If you want it to return "$mid(text,1,2)Ga", use /echo, not //echo.


I'm not sure but i think you misundestood what i trying to show, i don't want to return anything, there is just a problem, if 1$mid(text,1,2) return 1$mid(text,1,2), so $mid(text,1,2)1 should return $mid(text,1,2)1.

Quote:
The return of a nonexistent alias is $null, and //echo -a $null returns an error smile

I agree but it's not the case here, $mid()Ga can't be a name of an alias (custom or not) because there is bracket.
If mirc parsed it as an alias, i'll should have in echo :
Quote:
no such identifier $mid()Ga



#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
Ok - now I get your point, thanks for clarification.

Regarding the error message: I have "identifier warning" disabled.

This might be regarded as a bug, but also I can imagine it's acting this way by design.
For me it is some "syntax gray area" - and I'm not dropping my own "should return $null/error" rating for the issue...yet smile


Joined: Jul 2006
Posts: 4,145
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
Quote:
This might be regarded as a bug, but also I can imagine it's acting this way by design.


I agree but if it was a normal behavior (like $1's) the text after the $identifier should be returned too.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
I'd imagine the reason that it doesn't give an error when you append text to the end of an identifier is because of props. If a prop is invalid, the identifier will still return the value as if there wasn't a prop.

//echo -a $chan(#channelname).topic2

That will return the channel name rather than an error. If the prop isn't valid, it's removed. Of course, you could make it throw and error if there's no "." there. I'm just showing why it probably doesn't give an error.


Invision Support
#Invision on irc.irchighway.net
Joined: Jul 2006
Posts: 4,145
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
Good point, I don't think about that before, but $mid doesn't support .props (it's the same for other identifiers like $asc, $chr etc...), so if the text isn't a props (event invalid), mirc should return the text as a "plain text" :

Code:
//echo -a $chan(#channelname).topic2 < return channel name
//echo -a $chan(#channelname).topic  < return the topic of the channel
//echo -a $chan(#channelname)text    < imo, should return $chan(#channelname)text



#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
I disagree about it displaying plain text. It should give an error message, not display the code. Yes, if you put text before the identifier, it will display as plain text, but that's because there's no way to know if it's supposed to be an identifier if there isn't a $ as the first character.


Invision Support
#Invision on irc.irchighway.net
Joined: Jul 2006
Posts: 4,145
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
Hum i don't care in fact, but which error mirc can be returns ?

* $ident() invalid format ?


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Whatever Khaled feels like using would be fine, I'm sure.


Invision Support
#Invision on irc.irchighway.net
Joined: Jul 2006
Posts: 4,145
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
The first bug concerning the behavior of $N'text with text that contain number is still present is 6.31



#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
None of these are bugs, they're a reality of the mIRC parser.. that's why they were never "fixed". You really shouldn't be nitpicking about silly things like how mIRC reacts with code that violates the language syntax since the expected result is *UNDEFINED*. The invalid identifier warning you get is a convenience, not a requirement or guarantee. If you do something mIRC can't understand, that's your bug, not mIRC's.

As far as $1XYZ goes, that's a specific *feature* of the language, the same way the parser allows "//echo -a $mircdirSUBDIRECTORY" without using $+ for convenience. Not a bug.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"

Link Copied to Clipboard