mIRC Homepage

Dynamic variables

Posted By: Raccoon

Dynamic variables - 22/06/19 05:00 AM

Would it be possible to change the way the scripting language works and how variables are parsed to allow the "%operclosechan.%chan" variables below to be evaluated:

Code
set -eu10 %operclosechan.%chan %reason

if (%operclosechan.%chan) {

unset %operclosechan.%chan

This would require the scripting language to 1) disallow use of % anywhere in the variable name except at the beginning, and 2) interpret . followed by a % as a combining character in non-space-delimited text that interprets the % following the . as a variable name.
Posted By: Raccoon

Re: Dynamic variables - 22/06/19 10:54 AM

Originally Posted by Khaled noted
This would require the scripting language to 1) disallow use of % anywhere in the variable name except at the beginning, and 2) interpret . followed by a % as a combining character in non-space-delimited text that interprets the % following the . as a variable name.

Thanks. As far as the "." followed by "%" as a combining character in global parsing, I don't believe that to necessarily be the case. That would be a sub-branch parsing once you've already identified a variable -- a string leading with "%". For instance, foo.%bar would be a generic string with no special meaning, while %foo%bar and %foo.%bar would both be dynamically named variables. The dot is just for prettiness.

And yes, you would have to take away people's ability to use "%" as a literal character in the middle of variable names. As if a sane person would do this.
Posted By: Wims

Re: Dynamic variables - 22/06/19 12:57 PM

Hello,

This suggestion is being made every year or so by you, it's... wonderful.
It would be breaking backward compatibilities and practically speaking break a lot of scripts, I have no idea why khaled edited your post, as though this was not at the top of impossible changes to make.
If it has to be stated then ok: I'm absolutely against this idea which would just break compatibilities for no good reasons: there is not a single argument as to why this would be a good idea to have in the scripting language in the first place.
And I believe there's no argument because it would be for convenience only, this would not serve any real purpose, it would not help with functionalities.
Please focus on what can be improved/changed in mIRC, %variables parsing is not one of them.
Posted By: Raccoon

Re: Dynamic variables - 22/06/19 03:54 PM

First time I ever made this suggestion, yo.

And I'm not thinking about my own convenience, as I already have mad skillz. I'm thinking about the general readability and user-friendliness of the scripting language, so that these methods are easily accessible to other users besides myself.

As of 2019, there are zero published scripts on the Internet that use '%' as a character inside of a variable name. Backward compatibility cannot be destroyed unless it's something that has ever been used before -- which it hasn't.
© 2019 mIRC Discussion Forums