mIRC Homepage

$scriptwin alias identifier bug

Posted By: Protopia

$scriptwin alias identifier bug - 22/10/17 12:18 PM

I created a scriptwin alias and called it with "$scriptwin" but instead I got the results as if I had called "$script $+ win".
Posted By: Wims

Re: $scriptwin alias identifier bug - 22/10/17 01:22 PM

That's not a bug, some identifier such as $script allow you to stick text after them as though $+ were used
Posted By: Protopia

Re: $scriptwin alias identifier bug - 22/10/17 01:31 PM

Originally Posted By: Wims
That's not a bug, some identifier such as $script allow you to stick text after them as though $+ were used

Can you tell me where this is documented?
Posted By: maroon

Re: $scriptwin alias identifier bug - 22/10/17 04:53 PM

If you want to use this alias, you can still use it as a command.

/scriptwin these are the parameters

There are several others which do this:

Code:
//echo -a    $getdirABC
//echo -a   $mididirABC
//echo -a   $mircdirABC
//echo -a   $mircexeABC
//echo -a    $mp3dirABC
//echo -a $scriptdirABC
//echo -a   $wavedirABC


It looks like what they have in common is that they don't need () in order to return a folder/file name.
Posted By: Wims

Re: $scriptwin alias identifier bug - 22/10/17 05:55 PM

Some of this usage might be documented in versions.txt but this discussion actually came up on IRC with Sat, he ran a code testing all identifiers using :error from a list I had, the list wasn't that complete (~20 missing maybe) but it should be good:

$+,$++,$?,$?*,$*,$cd,$feof,$ferr,$getdir,$inmidi,$inmp3,$insong,$insong.pause,$inwave,$logdir,$mididir,$mircdir,$mircexe,$mircini,$mouse.key,$mouse.x
$mouse.y,$mouse.win,$mouse.mx,$mouse.my,$mouse.lb,$mouse.dx,$mouse.dy,$mp3dir,$script,$scriptdir,$scriptline,$snicks,$wavedir
Posted By: Protopia

Re: $scriptwin alias identifier bug - 22/10/17 06:44 PM

Why should "$scriptwin" act like "$script $+ win"? After all if you wanted it to act like that you could have coded "$script $+ win".

This still feels like a bug to me even if the boundaries have been mapped by experimentation.
Posted By: Sat

Re: $scriptwin alias identifier bug - 22/10/17 06:58 PM

As Wims mentioned, it is documented in versions.txt. See mIRC v5.7 point 100.
Posted By: Protopia

Re: $scriptwin alias identifier bug - 22/10/17 07:08 PM

What that point says is that it is a bug, but that a decision was made not to fix it for specific identifiers in order not to break some scripts which were poorly coded.

I can understand this decision as a short-term expediency, however IMO it would have been better to deprecate it in 5.7, issue warnings in 6.x and fix it in 7.x.

Or even perhaps to deprecate it in 5.7, to auto-fix the code in 6.x and revert to correct behaviour in 7.x.
Posted By: Sat

Re: $scriptwin alias identifier bug - 22/10/17 07:20 PM

It is not a bug, because it is now intended behavior, even if (in retrospect) undesirable. Bugs are by definition unintended.

mIRC tries very hard to avoid breaking backward compatibility with older scripts, so the approach that you describe simply will not happen. There is no real point in discussing it either, because Khaled has indicated many many times that this is how he approaches such cases. And ultimately it is his call, whether we agree with it or not (in this case I am impartial, FWIW).
Posted By: Protopia

Re: $scriptwin alias identifier bug - 22/10/17 07:25 PM

@Sat - Yes, I agree.
Posted By: Raccoon

Re: $scriptwin alias identifier bug - 23/10/17 05:34 AM

mSL is not supposed to be a pretty language, nor even a consistent one. It has 20 years of evolution, and it does the job fine if you read the documentation and experiment a little. There are dozens of ways to accomplish any task, and many of us just enjoy the puzzling nature of it all.

I'm glad we don't have to worry about Python 2 vs Python 3 around here.
Posted By: maroon

Re: $scriptwin alias identifier bug - 23/10/17 06:29 AM

The list posted by Ouims is a list of $identifiers and $identifier.properties which don't trigger the "no such identifier" warning, which means you can't name your own aliases within those namespaces until mIRC is fixed to allow creating alias names in some of those areas. Most of the items in the list do not report the appended text, returning the same thing whether or not there is appended text (even if it's $null), so Khaled would probably be safe in fixing those identifiers. For example, $scriptlineAPPENDEDTEXT returns the script line number regardless whether or not there is appended text.

So far, I've identified only the following identifiers that alter the output to include the appended text:

$cd,$getdir,$logdir,$mididir,$mircdir,$mircexe,$mircini,$mp3dir,$script,$scriptdir,$wavedir

The above list is probably the only ones that need to preserve the existing behavior. The above identifiers are divided into those which return a folder-only and those who return folder\filename. The reason for appending text to the identifier is for changing c:\path\ into c:\path\filename.ext, and I don't see it being that useful for appending to a filename.ext.

I might have missed a few identifiers that only exist within narrow contexts. For example, $cd only works within ON SERV, where $cdABC appends ABC to the foldername returned by $cd. However from the editbox $cd and $cdABC both return $null.
Posted By: Sat

Re: $scriptwin alias identifier bug - 23/10/17 04:11 PM

Good points, fully agreed.
© 2019 mIRC Discussion Forums