View Single Post
  #5  
Unread 01-06-2011, 07:30 PM
Marll's Avatar
Marll Marll is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Jan 2010
Posts: 51
So, I'm having an all new, fun problem. I've started to restructure my code and attempt to make notes in each section to get a better idea of what each block of code is doing.

Below is the code that I have currently, which should set up the quickslots (I think LOL) but when I load it into LOTRO the plugin manager shows that it is loaded but I see now window or quickslots. What could I be doing wrong?

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

import "RogidorPlugins.MountCarousel";

-- ==================================================================================================================
--			Load Function
--
-- ================================================================================================================== 
function LoadSettings()

settings = Turbine.PluginData.Load( Turbine.DataScope.Character, "MountCarouselSettings" );

	if ( type( settings ) ~= "table" ) then
		settings = { };
	end
	
	if ( not settings.welcome ) then
		settings.welcome = false;
	end

	if ( not settings.positionX ) then		
		settings.positionX = ( Turbine.UI.Display.GetWidth() - mainWindow:GetWidth() - edgePadding);		
	end
	
	if ( not settings.positionY ) then	
		settings.positionY = ( Turbine.UI.Display.GetHeight() - mainWindow:GetHeight() - edgePadding * 1.5 );
	end
	
	if ( not settings.alwayshide ) then
		settings.alwayshide = false;
	end
	
	if ( not settings.goat ) then
		settings.goat = false;
	end
	
	if ( not settings.qs1 ) then
		settings.qs1 = 0;
	end
	
	if ( not settings.qs2 ) then
		settings.qs2 = 1;
	end
	
	if ( not settings.qs3 ) then
		settings.qs3 = 2;
	end

	if ( not settings.cqs1 ) then
		settings.cqs1 = 0;
	end
	
	if ( not settings.cqs2 ) then
		settings.cqs2 = 1;
	end
	
	if ( not settings.cqs3 ) then
		settings.cqs3 = 2;
	end

end

-- =====================================================================================================================
--			Save Function
--
-- =====================================================================================================================

function SaveSettings()

Turbine.PluginData.Save( Turbine.DataScope.Character, "MountCarouselSettings", settings );

end

-- =======================================================================================================================
--			Save data on unload
--
-- =======================================================================================================================
if ( Plugins ["MountCarousel"] ~= nil ) then
	Plugins["MountCarousel"].Unload = function( sender, args )
		SaveSettings();
		Turbine.Shell.WriteLine("Mount Carousel Data Saved!")
	end
end

-- ========================================================================================================================
--			Creation of the Main "Mounts" Window in which to display the carousel of quickslots
--
-- ========================================================================================================================
edgePadding = 50;

mainWindow = Turbine.UI.Extensions.Window();
mainWindow:SetSize( 200 , 35 );
mainWindow:SetText("Mounts");
mainWindow:SetOpacity( 0 );
mainWindow:SetFadeSpeed( 0.5 );
mainWindow:SetVisible( true );

LoadSettings();

mainWindow:SetPosition(settings.positionX, settings.positionY);

-- ========================================================================================================================
--			Creation of the individual parent windows to house each of the quickslots in the carousel
--
-- ========================================================================================================================
farleftWindow = Turbine.UI.Extensions.SimpleWindow();
farleftWindow:SetSize( 35 , 35 );
farleftWindow:SetParent( mainWindow );
farleftWindow:SetPosition( 12.5, 60 );
farleftWindow:SetOpacity( 0.25 );
farleftWindow:SetFadeSpeed( 0.5 );
farleftWindow:SetVisible( true );

leftWindow = Turbine.UI.Extensions.SimpleWindow();
leftWindow:SetSize( 35 , 35 );
leftWindow:SetParent( mainWindow );
leftWindow:SetPosition( 47.5, 50 );
leftWindow:SetOpacity( 0.25 );
leftWindow:SetFadeSpeed( 0.5 );
leftWindow:SetVisible( true );

centerWindow = Turbine.UI.Extensions.SimpleWindow();
centerWindow:SetSize( 35 , 35 );
centerWindow:SetParent( mainWindow );
centerWindow:SetPosition( 82.5, 40 );
centerWindow:SetVisible( true );
centerWindow:SetAllowDrop( true );

rightWindow = Turbine.UI.Extensions.SimpleWindow();
rightWindow:SetSize( 35 , 35 );
rightWindow:SetParent( mainWindow );
rightWindow:SetPosition( 117.5, 50 );
rightWindow:SetOpacity( 0.25 );
rightWindow:SetFadeSpeed( 0.5 );
rightWindow:SetVisible( true );

farrightWindow = Turbine.UI.Extensions.SimpleWindow();
farrightWindow:SetSize( 35 , 35 );
farrightWindow:SetParent( mainWindow );
farrightWindow:SetPosition( 152.5, 60 );
farrightWindow:SetOpacity( 0.25 );
farrightWindow:SetFadeSpeed( 0.5 );
farrightWindow:SetVisible( true );

-- ===================================================================================================================
--			Creation of each of the quickslots to be displayed in the carousel
--
-- ===================================================================================================================
farleftqs = Turbine.UI.Lotro.Quickslot();
farleftqs:SetParent( farleftWindow );
farleftqs:SetPosition( 0, 0 );
farleftqs:SetSize( 35, 35 );
farleftqs:SetAllowDrop(false);

leftqs = Turbine.UI.Lotro.Quickslot();
leftqs:SetParent( leftWindow );
leftqs:SetPosition( 0, 0 );
leftqs:SetSize( 35, 35 );
leftqs:SetAllowDrop(false);

centerqs = Turbine.UI.Lotro.Quickslot();
centerqs:SetParent( centerWindow );
centerqs:SetPosition( 0, 0 );
centerqs:SetSize( 35, 35 );
centerqs:SetAllowDrop( true );
quickslot:SetUseOnRightClick( false );

rightqs = Turbine.UI.Lotro.Quickslot();
rightqs:SetParent( rightWindow );
rightqs:SetPosition( 0, 0 );
rightqs:SetSize( 35, 35 );
rightqs:SetAllowDrop(false);

farrightqs = Turbine.UI.Lotro.Quickslot();
farrightqs:SetParent( farrightWindow );
farrightqs:SetPosition( 0, 0 );
farrightqs:SetSize( 35, 35 );
farrightqs:SetAllowDrop(false);
Reply With Quote