mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2004
Posts: 2,127
maroon Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
In the presence of a local var, set -g alters the local var without affecting the global var. This also affects the -u0 switch, causing the global var to not be unset after the script.

There is no change regardless whether or not the -gu0 switches are used.

Code:
//set %a Global | var %a Local | echo -a %a / $var(%a,0) | set -gu0 %a Global2 | echo -a %a $var(%a,1).local $var(%a,1).value / $var(%a,2).local $var(%a,2).value | .timer 1 0 echo 5 -a % $+ a


Joined: Dec 2002
Posts: 5,420
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,420
Thanks for your bug report. The /set command has never had a -g switch. There is a /var -g switch which was requested many years ago which allows /var to affect global variables. However /set simply affects either local variables if they exist and, if they don't, global variables. That said, it should be possible to add a /set -g as well.

Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
Something I thought about, if /set -g is ever added, it might be worth nothing that /var -g currently calls /set without -g, and that shouldn't change, so possibly /var -g would need to be extended to get /set to use -g as well, to force the set of the global variable. A good (typical) idea: -g or -g0 for the current behavior (/set), and -g1 for /set -g


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
So, um, it was already added bro.

//set -sl %test local | set -sg %test global | echo -a $var(%test,0) : local? 1= $var(%test,1).local , 2= $var(%test,2).local : var= %test
//echo -a %test


> * Set %test to local
> * Set %test to global
> 2 : local? 1= $true , 2= $false : var= local
> global


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
I was under the impression it was already there but checked the help file only.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel

Link Copied to Clipboard