mIRC Home    About    Download    Register    News    Help

Print Thread
Dynamic variables #265631 22/06/19 05:00 AM
Joined: Feb 2003
Posts: 2,641
Raccoon Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,641
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.

Last edited by Khaled; 22/06/19 10:27 AM.

Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Re: Dynamic variables [Re: Raccoon] #265633 22/06/19 10:54 AM
Joined: Feb 2003
Posts: 2,641
Raccoon Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,641
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.


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Re: Dynamic variables [Re: Raccoon] #265634 22/06/19 12:57 PM
Joined: Jul 2006
Posts: 3,555
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,555
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.


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: Dynamic variables [Re: Wims] #265635 22/06/19 03:54 PM
Joined: Feb 2003
Posts: 2,641
Raccoon Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,641
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.

Last edited by Raccoon; 22/06/19 03:58 PM.

Well. At least I won lunch.
Good philosophy, see good in bad, I like!