View Single Post
  #13  
Unread 09-26-2010, 09:20 PM
Olenn's Avatar
Olenn Olenn is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Sep 2010
Posts: 47
Thanks for all of the help. I did what you said and its not giving me an error but it isn't working either.

The end goal is that you could drag the window where ever you want it and when you start the game back up later it remembers its position. I really thought this would be as easy an writing to a file when you stopped dragging the window, but its definitely been an all day project trying to get this to work.

I believe that my problem now is simply getting the plugin to save the lwindows location data. Everything else seems to be working fine.

Here is the main.lua I have thus far.

Code:
import "Turbine.UI";
import "Turbine.UI.Lotro";
import "Turbine.Debug";

import "Olenn.Satchel";

satchelWindow = Olenn.Satchel.SatchelWindow();
satchelWindow:SetVisible( true );

settingsWindow = Olenn.Satchel.SettingsWindow();
settingsWindow:SetVisible( true );

Turbine.UI.Lotro.LotroUI.SetEnabled( Turbine.UI.Lotro.LotroUIElement.Backpack1, false );
Turbine.UI.Lotro.LotroUI.SetEnabled( Turbine.UI.Lotro.LotroUIElement.Backpack2, false );
Turbine.UI.Lotro.LotroUI.SetEnabled( Turbine.UI.Lotro.LotroUIElement.Backpack3, false );
Turbine.UI.Lotro.LotroUI.SetEnabled( Turbine.UI.Lotro.LotroUIElement.Backpack4, false );
Turbine.UI.Lotro.LotroUI.SetEnabled( Turbine.UI.Lotro.LotroUIElement.Backpack5, false );

satchelCommand = Turbine.ShellCommand();

function satchelCommand:Execute(cmd, args)
	if ( args == "show" ) then
		SatchelWindow:SetVisible( true );
	elseif ( args == "hide" ) then
		SatchelWindow:SetVisible( false );
	elseif ( args == "toggle" ) then
		SatchelWindow:SetVisible( not SatchelWindow:IsVisible() );
	elseif ( args ~= nil ) then
		satchelCommand:GetHelp();
	end
	
	pluginName="Satchel";
	window = Turbine.UI.Window();
	window:SetWantsUpdates(true);
	window.Update = function(sender,args)
	if (Plugins[pluginName] ~= nil) then
		Plugins[pluginName].Unload = function(self,sender,args)
			UnloadPlugin();
			Turbine.PluginData.Save( Turbine.DataScope.Character, "Satchel", Data );
		end
		window:SetWantsUpdates(false);
	end
end
end


function satchelCommand:GetHelp()
	Turbine.Shell.WriteLine( "------------Satchel Commands------------");
	Turbine.Shell.WriteLine( "/satchel show: Display Satchel Window");
	Turbine.Shell.WriteLine( "/satchel hide: Hide Satchel Window");
	Turbine.Shell.WriteLine( "/satchel toggle: Toggle Satchel Window");
end

Turbine.Shell.AddCommand( "satchel", satchelCommand );
Reply With Quote