Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Miniwindows ➜ miniwindow position save state oddness

miniwindow position save state oddness

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


Posted by George   (9 posts)  Bio
Date Fri 15 Jul 2011 07:20 AM (UTC)
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
Top

Posted by Fiendish   USA  (2,535 posts)  Bio   Global Moderator
Date Reply #1 on Fri 15 Jul 2011 07:47 AM (UTC)
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.

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #2 on Fri 15 Jul 2011 07:55 AM (UTC)
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
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.


11,648 views.

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

Go to topic:           Search the forum


[Go to top] top

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