mIRC Home    About    Download    Register    News    Help

Print Thread
Identifiers begining with cd #62482 01/12/03 08:51 AM
Joined: Dec 2003
Posts: 3
U
Urgo Offline OP
Self-satisified door
OP Offline
Self-satisified door
U
Joined: Dec 2003
Posts: 3
Placed in remote section, events turned on
alias cda { return cda }
alias ada { return ada }
alias cdf { echo cbf }
alias cba { return cba }


The red lines are what I entered into mirc's command line

//echo Output of CDA: $cda
Output of CDA:
//echo Output of ADA: $ada
Output of ADA: ada
/cdf
Typed /cdf
//echo Output of CBA: $cba
Output of CBA: cba

It looks like $cd* is getting truncated to just $cd in mirc 6.12 (maybe 6.1x and higher) All my examples work fine in 6.0x and lower

Re: Identifiers begining with cd #62483 01/12/03 11:46 AM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
I'm not sure if you know this (although you mentioned $cd) but $cd is a built-in identifier that returns the currect directory in a fileserver. As you may also know, identifiers that return directories/files, like $mircdir, $scriptdir, $mircexe, $getdir etc do not need $+ when you want to append a string to them: (fex //echo -a $mircdirBLAH ). This also true for $1, $2, $1- etc identifiers. Now, if one of those identifiers is $null, it "consumes" the string appended to it:
//tokenize 32 a b | echo -a $1BLAH :: $3BLAH
This is exactly what happens with $cd. $cd returns $null, so $cda returns $null too.

$cda works in previous versions, but only from the command line (or inside aliases called from the command line). For example, the following line in v6.0:
on *:text:*:?: echo -s blah $cda
echoes "blah" when a message is received, ie $cda returns $null. From that aspect, I find v6.12 more consistent, because $cda works the same way, no matter where it's called from (the command line or a script): it returns $null in both cases.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Re: Identifiers begining with cd #62484 01/12/03 01:57 PM
Joined: Dec 2003
Posts: 3
U
Urgo Offline OP
Self-satisified door
OP Offline
Self-satisified door
U
Joined: Dec 2003
Posts: 3
Oh ok, now I understand why it is acting like that. Just annoying since I have a script that has an identifier named $cdr (emulating LISP) and all of a sudden it stopped working. smile Now that I know its not a *bug* persay I'll release a patch. Thanks qwerty.

Re: Identifiers begining with cd #62485 01/12/03 06:44 PM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
I agree, mirc should look in its list of predefined aliases first though. if an alias exists with the value (like your example) $cda, it should take presidence over $cd with the concatentation of a. Ex:

alias $cda { return a }

echo -a $cda
a

echo -a $+($cd,a)
(Value of $cd)a

echo -a $cdb
(Value of $cd)b


-KingTomato