mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: May 2013
Posts: 140
R
raycomp Offline OP
Vogon poet
OP Offline
Vogon poet
R
Joined: May 2013
Posts: 140
OK problem fixed


I am relatively new to mIRC scripting and want to develop my own bot. I deleted some code to make it shorter full script here: http://hawkee.com/snippet/5434/. Could not find an answer there.
I have loaded it and set it up with my details. On loading the script it saves the variables correctly. But when I exit and come back in and check script editor, select variables then the are gone again, and I must unload and reload the script toe set them again. I am posting the script as I got it there are a lot of remarks in there as well but the problem might be in there some where. I have tried mIRC 6.35 and 7.36


Last edited by raycomp; 01/02/15 01:31 PM. Reason: problem fixed
Joined: Sep 2014
Posts: 259
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Sep 2014
Posts: 259
I'm no expert, but one doesn't have to be an expert to know that those variables are local and not global :P

to create global variables do this:

set %VariableName Value

Last edited by Sakana; 01/02/15 12:50 PM.
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Originally Posted By: Sakana
I'm no expert, but one doesn't have to be an expert to know that those variables are local and not global :P

No, they're global.

Joined: May 2013
Posts: 140
R
raycomp Offline OP
Vogon poet
OP Offline
Vogon poet
R
Joined: May 2013
Posts: 140
problem fixed thank you

Joined: Sep 2014
Posts: 259
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Sep 2014
Posts: 259
Originally Posted By: Loki12583

No, they're global.


My bad. So I guess %var = value is identical to set %var value

Though now I wonder if OP's own (deleted) code had var %var = value in it or not :\

Last edited by Sakana; 01/02/15 02:00 PM.
Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
The "%var = value" syntax is indeed the same as "set %var value", you can see that using $eval:
Code:
//echo -a $eval(%var = 2)
However, /var declares a local variable but /set will only change the value of the variable, it won't make it global:
Code:
//var %test 5 | echo -a $var(%test,1).local | set %test 6 | echo -a $var(%test,0) -- $var(%test,1).local
/set only makes a variable global if it's not already declared as a local variable.


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

Link Copied to Clipboard