mIRC Home    About    Download    Register    News    Help

Print Thread
Extended /set. #201169 21/06/08 06:40 PM
Joined: Nov 2004
Posts: 804
Jigsy Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Nov 2004
Posts: 804
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?
Re: Extended /set. [Re: Jigsy] #201426 28/06/08 01:42 AM
Joined: Apr 2003
Posts: 342
M
MeStinkBAD Offline
Fjord artisan
Offline
Fjord artisan
M
Joined: Apr 2003
Posts: 342
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.


Beware of MeStinkBAD! He knows more than he actually does!
Re: Extended /set. [Re: MeStinkBAD] #201456 28/06/08 09:40 PM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
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"
Re: Extended /set. [Re: argv0] #201467 29/06/08 12:15 AM
Joined: Dec 2002
Posts: 2,021
R
RoCk Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,021

I agree if something like this were added, it would make more sense to add the -g switch to the /var command.

Re: Extended /set. [Re: RoCk] #201934 10/07/08 01:00 AM
Joined: Apr 2003
Posts: 342
M
MeStinkBAD Offline
Fjord artisan
Offline
Fjord artisan
M
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!
Re: Extended /set. [Re: MeStinkBAD] #201937 10/07/08 01:43 AM
Joined: Dec 2002
Posts: 2,962
S
starbucks_mafia Offline
Hoopy frood
Offline
Hoopy frood
S
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.
Re: Extended /set. [Re: starbucks_mafia] #201938 10/07/08 03:39 AM
Joined: Apr 2003
Posts: 342
M
MeStinkBAD Offline
Fjord artisan
Offline
Fjord artisan
M
Joined: Apr 2003
Posts: 342
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.


Beware of MeStinkBAD! He knows more than he actually does!
Re: Extended /set. [Re: MeStinkBAD] #201945 10/07/08 09:58 AM
Joined: Sep 2005
Posts: 2,881
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Some scripts use thousands of variables, how could they be easily and rapidly fixed?

Re: Extended /set. [Re: hixxy] #201949 10/07/08 12:20 PM
Joined: Mar 2006
Posts: 393
T
The_JD Offline
Fjord artisan
Offline
Fjord artisan
T
Joined: Mar 2006
Posts: 393
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


[02:16] * Titanic has quit IRC (Excess Flood)
Re: Extended /set. [Re: The_JD] #201953 10/07/08 01:54 PM
Joined: Jan 2006
Posts: 468
symphony Offline
Fjord artisan
Offline
Fjord artisan
Joined: Jan 2006
Posts: 468
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

Re: Extended /set. [Re: The_JD] #201961 10/07/08 05:50 PM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
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"
Re: Extended /set. [Re: argv0] #201966 10/07/08 06:34 PM
Joined: Jul 2006
Posts: 3,697
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,697
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


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: Extended /set. [Re: Jigsy] #201973 10/07/08 09:49 PM
Joined: Nov 2004
Posts: 804
Jigsy Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Nov 2004
Posts: 804
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?