mIRC Homepage
Posted By: Jigsy Extended /set. - 21/06/08 06:40 PM
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
Posted By: MeStinkBAD Re: Extended /set. - 28/06/08 01:42 AM
Originally Posted By: Jigsy
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.
Posted By: argv0 Re: Extended /set. - 28/06/08 09:40 PM
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.
Posted By: RoCk Re: Extended /set. - 29/06/08 12:15 AM

I agree if something like this were added, it would make more sense to add the -g switch to the /var command.
Posted By: MeStinkBAD Re: Extended /set. - 10/07/08 01:00 AM
/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.
Posted By: starbucks_mafia Re: Extended /set. - 10/07/08 01:43 AM
So instead you think it'd be better to break all existing scripts? I think people can live with the inconsistency.
Posted By: MeStinkBAD Re: Extended /set. - 10/07/08 03:39 AM
Originally Posted By: starbucks_mafia
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.
Posted By: hixxy Re: Extended /set. - 10/07/08 09:58 AM
Some scripts use thousands of variables, how could they be easily and rapidly fixed?
Posted By: The_JD Re: Extended /set. - 10/07/08 12:20 PM
I meve ruse "=" with var or set, n i shouldnt need to

Code:
var %nick My nick is
%nick = %nick JD


My nick is JD
Posted By: symphony Re: Extended /set. - 10/07/08 01:54 PM
Originally Posted By: The_JD
I meve ruse "=" with var or set, n i shouldnt need to

Code:
var %nick My nick is
%nick = %nick JD


My nick is JD


What's the point? confused
Posted By: argv0 Re: Extended /set. - 10/07/08 05:50 PM
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.
Posted By: Wims Re: Extended /set. - 10/07/08 06:34 PM
Originally Posted By: argv0
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
Posted By: Jigsy Re: Extended /set. - 10/07/08 09:49 PM
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
© mIRC Discussion Forums