mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2003
Posts: 2
I
ital Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
I
Joined: Mar 2003
Posts: 2
i ran across this little problem a couple minutes ago when i was making a little alias to space out letters using chr160 (non-breaking space) and i called the alias '160' so whenever i attempted:

//echo -a $160(this is a test)

this was the output: is a test)

but when i changed the 'return' to 'echo -a' and used it like this:

/160 this is a test

it worked properly, came out like this: t h i s   i s   a   t e s t

so i wondered what was going on and i changed the name of the alias to _nbsp and it works fine now as an identifier. oh ya.. im on mirc 6.03/xp pro.. and oh yeah, if you want the alias, here ya go:

_nbsp var %' $replace($strip($1-),$chr(32),$chr(160)),%'' 1,%_ | while $mid(%',%'',1) { %_ = $+(%_,$ifmatch,$iif(%'' < $len(%'),$chr(160))) | inc %'' } | return $iif(%_,%_,%')

(and yes im sure i could make that work better or use less code, but oh well..)

Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
What you described happens for a completely different reason: mirc allows you to attach stuff directly to certain identifiers and they are evaluated. Examples that come to mind are $1, $2 etc, $mircdir, $scriptdir, $mircexe, $cd.
In the case of $1, $2, $3 etc, the situation is like this: if $N (where N is a number) is not empty (for example if $1- has 4 words and you use $3), this:
$Nanything
becomes
<value of $N>anything
If $N is empty though (fex if you had used $5 in the previous example) then this:
$Nanything
becomes $null (empty). One would expect it to become
anything
but this isn't happening for some reason. So, "$160(this is a test)" is considered a "$160" attached to "(this is a test)". $160 represents the 160th word in the current script, which of course does not exist, so $160 and everything attached to it (up to the first space character) becomes $null. The part up to the first space is "$160(this" and it becomes $null, so what's left is " is a test)".

This isn't a bug but a side-effect of mirc's behaviour with certain identifiers. I know a lot of people who don't like this inconsistency (some identifiers are allowed to touch text, others aren't). Personally, I don't mind since I'm a lazy who likes to type "$scriptdirreadme.txt" instead of "$scriptdir $+ readme.txt"


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com

Link Copied to Clipboard