|
Joined: Nov 2004
Posts: 842
Hoopy frood
|
OP
Hoopy frood
Joined: Nov 2004
Posts: 842 |
I would like to see the ability to set global variables like the way you can set local variables.
E.g.
//set %network $network, %nick $nick, %chan $chan
Rather than doing:
set %network $network set %nick $nick set %chan $chan
Or, failing that, an option to make /var set global variables.
//var -g %network $network, %nick $nick, %chan $chan
What do you do at the end of the world? Are you busy? Will you save us?
|
|
|
|
Joined: Apr 2003
Posts: 342
Fjord artisan
|
Fjord artisan
Joined: Apr 2003
Posts: 342 |
I would like to see the ability to set global variables like the way you can set local variables.
E.g.
//set %network $network, %nick $nick, %chan $chan
Rather than doing:
set %network $network set %nick $nick set %chan $chan
Or, failing that, an option to make /var set global variables.
//var -g %network $network, %nick $nick, %chan $chan mIRC has a very bad record when it comes to constancy. /var actually calls /set -l, yet set doesn't use "=" as a delimiter. It should.
Beware of MeStinkBAD! He knows more than he actually does!
|
|
|
|
Joined: Oct 2003
Posts: 3,918
Hoopy frood
|
Hoopy frood
Joined: Oct 2003
Posts: 3,918 |
well, /set is a command whereas /var is a play on the "%var = value" syntax.. its not exactly consistent, but its not exactly meant to be, either.
the syntax isnt really relevant to the request though, it might indeed be useful to have a global switch for /var to set multiple vars at once.
/var -g %a = 1, %b = 2.. etc.
Last edited by Mentality; 28/06/08 09:42 PM.
- argv[0] on EFnet #mIRC - "Life is a pointer to an integer without a cast"
|
|
|
|
Joined: Dec 2002
Posts: 2,033
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,033 |
I agree if something like this were added, it would make more sense to add the -g switch to the /var command.
|
|
|
|
Joined: Apr 2003
Posts: 342
Fjord artisan
|
Fjord artisan
Joined: Apr 2003
Posts: 342 |
/set should require using an "=" between the variable and the contents it will be assigned. If you lack an "=" character it should throw an error. /var should also throw an error when no "=" exists. It should not be inconsistent as it is now.
Beware of MeStinkBAD! He knows more than he actually does!
|
|
|
|
Joined: Dec 2002
Posts: 2,962
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,962 |
So instead you think it'd be better to break all existing scripts? I think people can live with the inconsistency.
Spelling mistakes, grammatical errors, and stupid comments are intentional.
|
|
|
|
Joined: Apr 2003
Posts: 342
Fjord artisan
|
Fjord artisan
Joined: Apr 2003
Posts: 342 |
So instead you think it'd be better to break all existing scripts? I think people can live with the inconsistency. Yes, it will break existing scripts. Which can easily and rapidly be fixed. Inconsistency is a very bad thing. You can't use intuitive thinking if things don't follow a pattern. mIRC's language is incredibly counter intuitive if you have not noticed.
Beware of MeStinkBAD! He knows more than he actually does!
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
Some scripts use thousands of variables, how could they be easily and rapidly fixed?
|
|
|
|
Joined: Mar 2006
Posts: 398
Pan-dimensional mouse
|
Pan-dimensional mouse
Joined: Mar 2006
Posts: 398 |
I meve ruse "=" with var or set, n i shouldnt need to var %nick My nick is
%nick = %nick JD My nick is JD
[02:16] * Titanic has quit IRC (Excess Flood)
|
|
|
|
Joined: Jan 2006
Posts: 468
Fjord artisan
|
Fjord artisan
Joined: Jan 2006
Posts: 468 |
I meve ruse "=" with var or set, n i shouldnt need to var %nick My nick is
%nick = %nick JD My nick is JD What's the point?
|
|
|
|
Joined: Oct 2003
Posts: 3,918
Hoopy frood
|
Hoopy frood
Joined: Oct 2003
Posts: 3,918 |
you *do* need to use = with var. There are plenty of edge cases that break /var when = isn't used. When your script breaks and you have no clue why, don't come crying to the messageboard.
In any case, it's completely unjustified to ever say "I shouldn't need to follow syntax rules"
As for the claim of inconsistency-- it's not really that inconsistent. "var" is a keyword that is meant to modify the %var = value statement, whereas set is a regular command. I say it's a "keyword" because it's only valid in script (it's not a normal builtin command). This is seen by typing /var %x = 1 in the editbox (one '/'). It will give "VAR unknown command".
So you can either use the syntactic/keyword form to set variables as such (where 'var' modifies the var as a local):
[var] %var = value
or by command form:
/set %var value
Note that it's the syntax that makes it possible to do things like "var %x = 1, %y = 2".. it would be more inconsistent to treat commas as special characters with a regular /command. The syntax distinction makes it more obvious that "," will be treated as a variable definition separation (in clear cases)
So to say 'var %x = 1' is inconsistent would be like saying '%x = 1' is inconsistent.. it's not, it's a distinctly different syntax. And if you don't like using "=" on your variables, then what you really want is the /set command, not the var %x = 1 form.
- argv[0] on EFnet #mIRC - "Life is a pointer to an integer without a cast"
|
|
|
|
Joined: Jul 2006
Posts: 4,222
Hoopy frood
|
Hoopy frood
Joined: Jul 2006
Posts: 4,222 |
you *do* need to use = with var. There are plenty of edge cases that break /var when = isn't used. Even if i agree = should be used in /var, since 6.32 (at least, i think this is true for 6.31 and maybe 6.3), use it or not make no difference.Before, mirc could give an error if ",%var" was used as a data, here is a interesting topic, where all of this has been already asked/clarified, it seemed that a switch for /var appear to be the best solution
#mircscripting @ irc.swiftirc.net == the best mIRC help channel
|
|
|
|
Joined: Nov 2004
Posts: 842
Hoopy frood
|
OP
Hoopy frood
Joined: Nov 2004
Posts: 842 |
What the heck have I started. ;o
I'd like to point out that I do use = with /var, but since I'm not telepathic and don't know if others use it when using /var, I left it out of my example. :P
What do you do at the end of the world? Are you busy? Will you save us?
|
|
|
|
|