LoTROInterface

LoTROInterface (https://www.lotrointerface.com/forums/index.php)
-   Lua Programming Help (L) (https://www.lotrointerface.com/forums/forumdisplay.php?f=50)
-   -   Issues with loading plugin (https://www.lotrointerface.com/forums/showthread.php?t=1276)

goldbishop 12-01-2010 08:28 PM

Issues with loading plugin
 
Alright, i have done as much as i can to figure this out but have come up dry.

In game return:
Quote:

...gins\GoldbishopsPlugins\FrameworkReport\__init_ _.lua:1: Failed to import package "GoldbishopsPlugins.FrameworkReport.FrameworkRepor tWindow".
...\Plugins\GoldbishopsPlugins\FrameworkReport\Mai n.lua:2: Failed to import package "GoldbishopsPlugins.FrameworkReport".
Unable to load "frameworkreport".
Code Files
__init__.lua
Quote:

import "GoldbishopsPlugins.FrameworkReport.FrameworkRepor tWindow";
Main.lua
Quote:

import "Turbine";
import "GoldbishopsPlugins.FrameworkReport";

--Setup Framework Report Window
FrameworkReport = FrameworkReportWindow();
FrameworkReport:SetVisible( true );

--FrameworkReport Command
FrameworkReportCommand = Turbine.ShellCommand();

function FrameworkReportCommand:GetHelp()
local h = { query = "used to requery the framework",
help = "returns a list of acceptable commands",
show = "use to show Report Window",
hide = "use to hide Report Window",
toggle = "use to flip visibility of Report Window",
refresh = "use to refresh the Report Window" }
return h;
-- Turbine.Shell.WriteLine
-- for k, v in pairs(h) do
-- help = k .. ": " .. v .. "\n\n"
-- end
end

function FrameworkReportCommand:Execute( command, arguments )
if (arguments == "query") then
--TODO: Add re-querying
-- elseif ( arguments == "help" or arguments == "?" ) then
-- GetCommandHelp;
elseif ( arguments == "show" ) then
FrameworkReport:SetVisible( true );
elseif ( arguments == "hide" ) then
FrameworkReport:SetVisible( false );
elseif ( arguments == "toggle" ) then
FrameworkReport:SetVisible( not FrameworkReport .IsVisible() );
elseif ( arguments == "refresh" ) then
FrameworkReport:Refresh();
end
end

Turbine.Shell.AddCommand( "tob;frameworkreport", FrameworkReportCommand );

--Return the Commands available for the plugin
function GetCommandHelp()

end

Digital_Utopia 12-01-2010 08:31 PM

Whatever the problem is, it's not in Main, but in your ReportWindow class. When you get that kind of an error message it means basically...

It can't import the package (class) because there's something wrong with it - usually a typographical error as opposed to a logic error.

goldbishop 12-01-2010 08:35 PM

Tried reviewing this file more than a few hours and even rebuilt it several time just in case.

FrameworkReportWindow.lua
Quote:

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

FrameworkReportWindow = class( Turbine.UI.Extensions.SimpleWindow );

function FrameworkReportWindow:Constructor()
Turbine.UI.Extensions.Window.Constructor( self );

local edgePadding = 25;

self:SetSize( 400, 400 );
self:SetPosition( Turbine.UI.Display.GetWidth() - self:GetWidth() - edgePadding, Turbine.UI.Display.GetHeight() - self:GetHeight() - edgePadding * 1.5 );
self:SetBackColor( Turbine.UI.Color( .5, 0.0, 0.0, 1.0) );
self:SetText( "Framework Report Window" );
self:SetOpacity( 1.0 );
self:SetFadeSpeed( 1.0 );

self:MouseEnter = function( sender, args )
sender:SetOpacity( 1.0 );
end

self:MouseLeave = function( sender, args )
sender:SetOpacity( 0.0 );
end

self.listNamespace = Turbine.UI.ListBox();
self.listNamespace:SetParent( self );
self.listNamespace:SetPosition( 25, 5 );
self.listNamespace:SetSize( 100, 15 );
self.listNamespace:SetVisible( true );

self.listClass = Turbine.UI.ListBox();
self.listClass:SetParent( self );
self.listClass:SetPosition( 150, 5 );
self.listClass:SetSize( 100, 15 );
self.listClass:SetVisible( true );

self.scrollBar = Turbine.UI.Lotro.ScrollBar();
self.scrollBar:SetParent( self );
self.scrollBar:SetOrientation( Turbine.UI.Orientation.Vertical );
self.scrollBar:SetPosition( 375, 0 );
self.scrollBar:SetSize( 25, 400 );
self.scrollBar:SetVisible( true );

self.textBox = Turbine.UI.Lotro.TextBox();
self.textBox:SetParent( self );
self.textBox:SetMultiline( true );
self.textBox:SetReadOnly( true );
self.textBox:SetPosition( 25, 30 );
self.textBox:SetWidth( 350 );
self.textBox:SetVerticalScrollBar( self.scrollBar )
self.textBox:SetVisible( true );

self:Refresh();
end

function FrameworkReportWindow:Refresh()
self:PerformLayout();
end

function FrameworkReportWindow:PerformLayout()
self:Layout( { } );
end

function FrameworkReportWindow:Layout( args )
local width, height = self:GetSize();
end

D.H1cks 12-01-2010 08:59 PM

have you tried changing:
Turbine.UI.Extensions.Window.Constructor( self );

to

Turbine.UI.Extension.SimpleWindow.Constructor(self );

?

Digital_Utopia 12-01-2010 09:21 PM

Quote:

Originally Posted by goldbishop (Post 5718)
Tried reviewing this file more than a few hours and even rebuilt it several time just in case.

FrameworkReportWindow.lua

Most of it looks alright, but the following has got me scratching my head (in yellow)

Code:

function FrameworkReportWindow:Refresh()
self:PerformLayout();
end

function FrameworkReportWindow:PerformLayout()
self:Layout( { } );
end

function FrameworkReportWindow:Layout( args )
local width, height = self:GetSize();
end

When you make functions inside a class, they're generally made like so:

Code:

function self:Refresh()
    self:PerformLayout();
end


goldbishop 12-01-2010 09:38 PM

Quote:

Originally Posted by D.H1cks (Post 5719)
have you tried changing:
Turbine.UI.Extensions.Window.Constructor( self );

to

Turbine.UI.Extension.SimpleWindow.Constructor(self );

?

Yep....and even tried using the Core Window class and same result. Im sure im missing something but i just cant put my finger on it.

At first it was a semi-colon but still reported same error.

Problem so far seems to be the MouseEnter and MouseLeave functions being declared with a delta function inside the constructor. Pulled them out into the body of the file and worked just grand.


Side Note:
What is the name of the control that acts like a Drop-Down List box?

goldbishop 12-01-2010 09:41 PM

Quote:

Originally Posted by Digital_Utopia (Post 5720)
Most of it looks alright, but the following has got me scratching my head (in yellow)

Code:

function FrameworkReportWindow:Refresh()
self:PerformLayout();
end

function FrameworkReportWindow:PerformLayout()
self:Layout( { } );
end

function FrameworkReportWindow:Layout( args )
local width, height = self:GetSize();
end

When you make functions inside a class, they're generally made like so:

Code:

function self:Refresh()
    self:PerformLayout();
end


Think of those as stationary templates....till i get to the point of actually implementation.

D.H1cks 12-01-2010 09:43 PM

Ah, try changing them to self.MouseEnter = function(sender,args) and self.MouseLeave = function(sender,args) ?

This is what I have in my plugin:
Code:

        self.MouseEnter = function(sender, args)
                self:SetBackColor(self.bgColor);
        end

        self.MouseLeave = function(sender, args)
                self:SetBackColor(Turbine.UI.Color(0,0,0,0));
        end


goldbishop 12-01-2010 09:47 PM

when doing that signature do i need to have it all on one line or can i split it up across several lines as long as the end tag is there?

I borrowed the code from their Plugis templates provided by the packages. For some reason it didnt like them in my plugin. Thinking im missing some Import or something.

D.H1cks 12-01-2010 10:15 PM

OK, I have to go back a step here and ask. Is there really a space between the r and t in your __init__.lua file? As in
Code:

FrameworkReport.FrameworkRepor tWindow


All times are GMT -5. The time now is 01:33 AM.

vBulletin® - Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
© MMOUI