So I made a miniwin plugin that works wonders.... if it's reinstalled. The issue I have is that if close my world, and open it again, the miniwin stops working. It only displays the window, but nothing ever is written once the trigger that updates the writing is activated. If I go to File > plugins > reinsttall, the plugin comes back to life and works exactly as intended.
Aditionally, I installed movewindow into it, and whenever I reload the world, the plugin begins at the initial position, top left, and stays there for a few seconds before it jumps back to the last saved position in the screen.
I deconstructed the code to leave only the essential part of how it works in an attempt to find what's the issue, however I'm not particularly an expert in Lua or plugins, and so I haven't found the problem. I paste this oversimplified version of the code I deconstructed that still preserves the same problem I've been having. Any help would be most amazing!
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Bits of this plugin and ideas were borrowed and remixed from the MUSHclient community.-->
<muclient>
<plugin
name="test"
author="H"
id="8c1ab2792ea52210aa67798f"
language="Lua"
purpose="Displays test"
date_written="2015-01-28"
date_modified="2015-01-29"
requires="4.52"
version="2.0"
save_state="y"
>
<description trim="y">
</description>
</plugin>
<triggers>
<trigger
enabled="y"
expand_variables="y"
keep_evaluating="y"
match="Hall of the Fellowship."
script="test_update"
sequence="100"
></trigger>
</triggers>
<script>
require "movewindow" -- load the movewindow.lua module
win = GetPluginID ( )
font = "f"
window_width = 200
window_heigth = 300
WINDOW_POSITION = miniwin.pos_top_left
WindowFont ( win, font, "arial", 10, false)
WindowCreate ( win, 0, 0, window_width, window_heigth, WINDOW_POSITION, 0, 0x000000)
WindowRectOp( win, miniwin.rect_draw_edge, 2, 2, -2, -2, miniwin.rect_edge_etched, miniwin.rect_edge_at_all)
WindowText ( win, font, "this", 50, 100, 0, 0, ColourNameToRGB ( "red" ) )
WindowShow ( win )
-- windowinfo = movewindow.install (win, WINDOW_POSITION)
-- movewindow.add_drag_handler (win, 0, 0, 0, 0)
function test_update ()
refresh()
WindowText ( win, font, "that", 100, 100, 0, 0, ColourNameToRGB ( "red" ) )
WindowShow ( win )
end
function refresh()
WindowRectOp (win, miniwin.rect_fill, 0, 0, 0, 0, ColourNameToRGB ("black"))
WindowRectOp( win, miniwin.rect_draw_edge, 2, 2, -2, -2, miniwin.rect_edge_etched, miniwin.rect_edge_at_all)
end
-- hide window on removal
function OnPluginClose ()
WindowShow (win, false) -- hide it
end -- OnPluginClose
-- hide window on disable
function OnPluginDisable ()
WindowShow (win, false) -- hide it
end -- OnPluginDisable
-- show window on enable
function OnPluginEnable ()
WindowShow (win, true) -- show it
end -- OnPluginEnable
function OnPluginInstall()
WindowShow (win, true) -- show it
end
function OnPluginSaveState ()
-- save window current location for next time
-- movewindow.save_state (win)
end -- function OnPluginSaveState
</script>
</muclient>
For example, this code should display "this," and after the trigger happens, it should display "that". On reinstall, this is exactly how it works. If I get out of the world and reopen it again, "this" won't be displayed, only the black window will be there, and the trigger won't change anything. On reinstall, it goes back to working right. |