[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Bug reports
. . -> [Subject]  Possible SetVariable/DeleteVariable bug

Possible SetVariable/DeleteVariable bug

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Poromenos   Greece  (1,037 posts)  [Biography] bio
Date Mon 24 May 2004 10:47 AM (UTC)
Message
It has been a long time since I did this, and it could be my fault, but I thought I'd tell you to check it out in case it was a bug, can't hurt anyway :)
A few weeks ago I was making a plugin to store an array in variables. What I did was this:

Dim intCounter
For intCounter = 1 to 10
    DeleteVariable "World_Variable_" & intCounter
Next
SetVariable "World_Variable_1", "stuff"


The state file had 3 variables in it, "World_Variable_1" to 3. The script deleted them and added the variable 1, but they weren't deleted from the state file. No matter how many times I ran it, it always had 3 variables in it. I even did World.Note to see if they were deleted, and it clearly showed that it deleted the 3 variables and inserted the other one, but when I ran it again, it still deleted 3 variables. I just deleted the state file and it runs fine now, but it struck me as odd... Maybe Nick could look into it?

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Mon 24 May 2004 11:37 PM (UTC)
Message
I can't reproduce that. You need to save the state file (eg. remove the plugin) first, the state file is not saved moment-by-moment.

However my test plugin works - once the variables are deleted, and the plugin closed and re-opened, the variables are gone.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Poromenos   Greece  (1,037 posts)  [Biography] bio
Date Reply #2 on Tue 25 May 2004 10:30 AM (UTC)
Message
This script was run on OnPluginInstall, and I was reloading the plugin... Reloading saves the variables, doesn't it?

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Tue 25 May 2004 09:54 PM (UTC)
Message
Reloading should save the variables, yes.

Are the variables also in the plugin itself? Not that it should matter. Are you sure the OnPluginInstall script runs?

Try putting in a note, like I did:


sub OnPluginInstall
Dim intCounter
Note "in OnPluginInstall"

For intCounter = 1 to 10
    Note "delete = " & DeleteVariable ("World_Variable_" & intCounter)
Next
SetVariable "World_Variable_1", "stuff"
end sub


That confirms that the script ran, and shows the results of the deletion. You should see either of these cases:


in OnPluginInstall
delete = 0
delete = 0
delete = 0
delete = 0
delete = 0
delete = 0
delete = 0
delete = 0
delete = 0
delete = 0

in OnPluginInstall
delete = 0
delete = 30019
delete = 30019
delete = 30019
delete = 30019
delete = 30019
delete = 30019
delete = 30019
delete = 30019
delete = 30019


The first variable is always there (hence the result 0) because of the line:


SetVariable "World_Variable_1", "stuff"


... which is done after the deletes.

Try doing: world.debug "plugins" just before closing the plugin, to confirm that the variables are really deleted. Maybe the plugin puts them back.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Poromenos   Greece  (1,037 posts)  [Biography] bio
Date Reply #4 on Wed 26 May 2004 10:21 AM (UTC)

Amended on Wed 26 May 2004 10:22 AM (UTC) by Poromenos

Message
I did, that's what surprised me. I put the notes just under the deletes/inserts, so I know they ran, but they were recreated every time I loaded the plugin... I didn't think to return the result of the DeleteVariable though, so maybe that failed. Now I can't test it, it doesn't do it any more. :( The variables were not in the file, because I deleted the state file and it runs ok now... I guess I should have reported it back then, but I thought I must be doing something wrong, and since it worked I didn't see any more trouble with it. :/

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


12,015 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]