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 |