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

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Miniwindows
. . -> [Subject]  miniwindow position save state oddness

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

miniwindow position save state oddness

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Posted by George   (5 posts)  [Biography] bio
Date Fri 15 Jul 2011 07:20 AM (UTC)  quote  ]
Message
hi, I'm just starting to play with miniwindows and I'm running into some oddness that I'd like to understand.

Here's my basic plugin:


<script>
require "movewindow"

win = "test_" .. GetPluginID()

function OnPluginInstall ()

  windowinfo = movewindow.install(win, 12)

  WindowCreate(win, windowinfo.window_left, windowinfo.window_top, 200, 200, windowinfo.window_mode, windowinfo.window_flags, ColourNameToRGB("white"))

  movewindow.add_drag_handler(win, 0, 0, 0, 0, 10)

  WindowShow(win, true)
end

function OnPluginSaveState ()
  movewindow.save_state(win)
end

</script>


This works as expected, giving a draggable white square which saves its position when you close the world and reopen it.

However when I remove the plugin, close the world and reopen it, and then install the plugin again, the white square appears in the last saved position.

I'm assuming this is because the state file isn't cleaned up . The state file is saved to the worlds/plugins folder of the directory of the mushclient .exe, not the worlds/plugins/state directory (which I created first) as mentioned in the SaveState doc but I'm not sure if that doc is outdated.

Basically I'd like the old state to be removed if the plugin is removed then reinstalled -- what's the preferred way to do that? Or is this expected behaviour?


thanks, George
[Go to top] top

Posted by Fiendish   USA  (848 posts)  [Biography] bio   Global Moderator
Date Reply #1 on Fri 15 Jul 2011 07:47 AM (UTC)  quote  ]
Message
Quote:
However when I remove the plugin, close the world and reopen it, and then install the plugin again, the white square appears in the last saved position. I'm assuming this is because the state file isn't cleaned up.

This is expected behavior. And I certainly don't want settings clobbered because the player temporarily removed a plugin.

Quote:
The state file is saved to the worlds/plugins folder of the directory of the mushclient .exe, not the worlds/plugins/state directory (which I created first) as mentioned in the SaveState doc but I'm not sure if that doc is outdated.
Huh. I've never had that happen.

http://aardwolfclientpackage.googlecode.com/
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Fri 15 Jul 2011 07:55 AM (UTC)  quote  ]
Message
George said:

However when I remove the plugin, close the world and reopen it, and then install the plugin again, the white square appears in the last saved position.


I would not expect that removing a plugin (perhaps because you are having some clash of some sort with another plugin) should delete its state file. For some players the state file might contain months of gathered data (eg. mobs, friends) and they would be most upset if deleting the plugin removed its state file.

I would prefer if you had something like a "reset to defaults" action that cleaned up any variables that might be saved in the state file.

George said:

The state file is saved to the worlds/plugins folder of the directory of the mushclient .exe, not the worlds/plugins/state directory (which I created first) as mentioned in the SaveState doc but I'm not sure if that doc is outdated.


The documentation should be correct, does anyone else observe this behaviour? The state file folder is now saved in the "world preferences" database, from memory, so perhaps that got corrupted. I think that if it can't find the state file folder it asks you to choose one, so perhaps that is what you did.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[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.


921 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

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

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]