mIRC Homepage

Identifiers begining with cd

Posted By: Urgo

Identifiers begining with cd - 01/12/03 08:51 AM

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
Posted By: qwerty

Re: Identifiers begining with cd - 01/12/03 11:46 AM

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.
Posted By: Urgo

Re: Identifiers begining with cd - 01/12/03 01:57 PM

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.
Posted By: KingTomato

Re: Identifiers begining with cd - 01/12/03 06:44 PM

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
© 2021 mIRC Discussion Forums