mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Nov 2004
Posts: 10
N
noize Offline OP
Pikka bird
OP Offline
Pikka bird
N
Joined: Nov 2004
Posts: 10
I have no problem with the aliases, or remote files of the script, but when I go to unload (actually unset) the variables file I am having problems. 1st I started off just trying to fire an unload event, in which I found out that -rv is an invalid switch for that command. So I dediced to try unset. I noticed it was wiping out the variables actually in the file iteself so I use /unset -s command to see if that would solve the problem. It seem to have worked, I checked the variables file and all where there. I opened the script editor and the variables were not there, so I was happy, until I check the variables file again. They were removed because of me opening the script editor... for some reason at the bottom it was reading that it was still using that file but when you checked the view menu, it showed a different file name. I also tried just closing the client after an unload to see if that would hep and it still removed the variables from the file. Is there any successful way around this to be able to remove variables when a script is unloaded without removing them from the source file in which they came from?


- noize
Joined: May 2004
Posts: 95
W
Babel fish
Offline
Babel fish
W
Joined: May 2004
Posts: 95
im not sure i understand the problem. mirc saves the variables in remote.ini (along with some other things). unloading a script shouldnt change the script file itself (unless an unload event in there does that). /help /unload shows indeed -rv switch doesnt exist for it. maybe you could try to explain the problem a bit better and possibly show some code.

wiebe

Joined: Nov 2004
Posts: 10
N
noize Offline OP
Pikka bird
OP Offline
Pikka bird
N
Joined: Nov 2004
Posts: 10
ok, in my script I am not using the default files for aliases, remote or variables information. Here is an example of the script:

loader.mrc file

on 1:load:{
.load -a script\aliases.mrc
.load -rs script\remote.mrc
.load -rv script\variables.mrc
echo -a successfully loaded
}
on 1:unload:{
.unload -a script\aliases.mrc
.unload -rs script\remote.mrc
echo -a successfully unloaded
}

What I am trying to accomplish is if the user unloaded the script, it will unload the variables file and remove any variables associated with it from the script editor without removing any of the variables from the variables file.

There is no kind of switch for unloading variables and when I try to use /unset command it removes the variables from the file also. So this is where I am stuck at and need help figuring out a work around.

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
I cant quite work out what you want, but from what i read
(1) what about unloading your variables file first, so its no longer in use or
(2) setoff a timer(s) to unset the variables unload all your files then let the timer clear up the variables

Joined: Nov 2004
Posts: 10
N
noize Offline OP
Pikka bird
OP Offline
Pikka bird
N
Joined: Nov 2004
Posts: 10
in the unload command, there is not a switch to remove an actual variable script file. If you just try to unset the variables, it actually removes not only the value that is set but also the variable name from script editor and the variable script file.

Some of the potiental users of my script run multiple scripts and prefer to run 1 at a time. I was trying to accomplish a full unload of anything related to my script and then on reload, the variables are set again with the values the user had orginally set.

I figured out a work around, but not sure if it is the best method to use. It is as following:

on *:load:{
.load -a script\aliases.mrc
.load -rs script\remote.mrc
.load -rv script\variables.mrc
}
on *:unload:{
.unload -a script\aliases.mrc
.unload -rs script\remote.mrc
.save -rv variables.mrc
.unset -s %scriptname*
.remove -b script\variables.mrc
.rename variables.mrc script\variables.mrc
}

It would be nice if the load & unload commands had the same switches. frown


Link Copied to Clipboard