lotrointerface.com
Search Downloads


Go Back   LoTROInterface > LotRO > General Discussion & Support > Interface Requests (L)

Reply
Thread Tools Display Modes
  #11  
Unread 06-02-2011, 10:40 AM
Fortunis's Avatar
Fortunis Fortunis is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Mar 2011
Location: Leeds, UK
Posts: 72
self.myplugin was changed.
writeline i placed in a few places. before, in and after IF statement (nothing)
writeline placed outside this function ( i got spammed )
This function is defined in the update part of the LUA, which gets called alot.
SetWantsKeyEvents havnt been used
Reply With Quote
  #12  
Unread 06-02-2011, 11:55 AM
Digital_Utopia's Avatar
Digital_Utopia Digital_Utopia is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Sep 2010
Posts: 207
Send a message via MSN to Digital_Utopia Send a message via Yahoo to Digital_Utopia
Quote:
Originally Posted by Garan
Digital_Utopia's example has two small typos, where it says ":setVisible" it needs to be ":SetVisible" and "isVisible" should be "IsVisible"
aaand fixed. I will keep my opinions about starting off function names with uppercase letters to myself
__________________

Lord of the Rings Online
75 Fourohfour | 75 Artemedis | 60 Whiskeytango Foxtrot | 50 Mistah Boombastic | 56 Appetizer | 25 Aggromi
61 Onepointtwentyone Gigawatts


World of Warcraft
90 Downlo 85 Gravetaxi 85 Ümad 85 Artemedis 85 Guthuros
Reply With Quote
  #13  
Unread 06-02-2011, 12:01 PM
Digital_Utopia's Avatar
Digital_Utopia Digital_Utopia is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Sep 2010
Posts: 207
Send a message via MSN to Digital_Utopia Send a message via Yahoo to Digital_Utopia
Quote:
Originally Posted by Fortunis
SetWantsKeyEvents havnt been used
And that is likely the problem. Anything you want to respond to key events needs to call SetWantsKeyEvents(true).

so in the case of my original example, you would need to precede it with the following line for it to work:

Code:
self.SetWantsKeyEvents(true);
Otherwise, just like handling mouse events, or update events, if you don't call the appropriate "SetWants" function to set it to true- the event will never fire.
__________________

Lord of the Rings Online
75 Fourohfour | 75 Artemedis | 60 Whiskeytango Foxtrot | 50 Mistah Boombastic | 56 Appetizer | 25 Aggromi
61 Onepointtwentyone Gigawatts


World of Warcraft
90 Downlo 85 Gravetaxi 85 Ümad 85 Artemedis 85 Guthuros
Reply With Quote
  #14  
Unread 06-02-2011, 12:12 PM
Fortunis's Avatar
Fortunis Fortunis is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Mar 2011
Location: Leeds, UK
Posts: 72
K, thanks. Ill give that a go then
Reply With Quote
  #15  
Unread 06-02-2011, 01:16 PM
Fortunis's Avatar
Fortunis Fortunis is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Mar 2011
Location: Leeds, UK
Posts: 72
Ok, i got it to work and tweaked it to do everything i need it to for Mouse Cursor Highlighter Advanced.

Decided to post my part of the code for others to get an idea of what to add/do..
  • OptionsWindow is the menu window
  • mcha is the mouse cursor highlighter
  • WasOn and WasOnn are variables to help the code know that they were on previously, so they appear when F12 brings the UI back to visible.
The two IF statement parts at the bottom (outside the function) couldnt be introduced into the function code as this contradicted each other and caused either the option window to stay on even after trying to close it via the cross in its upper right, or do a few other anomolies.

Code:
self:SetWantsKeyEvents(true);
    
    self.KeyDown = function(sender,args)
    
        if (args.Action == 268435635)then
            if(OptionsWindow:IsVisible() == true)then
                WasOn = 1;
            elseif WasOn == 1 then
                OptionsWindow:SetVisible(true);
                WasOn = 0;
            end
            if(mcha:IsVisible() == true)then
                WasOnn = 1;
            elseif WasOnn == 1 then
                WasOnn = 0;
            end
        end
    
    end
    
    if WasOn == 1 then
        OptionsWindow:SetVisible(false);
    end
    
    if WasOnn == 1 then
        mcha:SetVisible(false);
    else
        mcha:SetVisible(true);
    end

Last edited by Fortunis : 06-03-2011 at 03:16 AM.
Reply With Quote
  #16  
Unread 06-05-2011, 08:58 AM
Emberleaf's Avatar
Emberleaf Emberleaf is offline
The Unscathed
 
Join Date: Sep 2010
Posts: 17
Quote:
Originally Posted by Garan
MoorMap has had this functionality for many months, as has AltInventory..
Well...I feel dumb now. :P

Thanks for clueing me in, Garan! Your plugin is insanely awesome!!
Reply With Quote
  #17  
Unread 07-13-2011, 12:15 PM
Equendil Equendil is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Apr 2011
Posts: 52
In case it helps, I'm using the following in my plugins, so I can manage my windows generically for F12 and Escape (the actual version I use also handles CTRL+\ for my drag bars, but I stripped that here):

Code:
import "Turbine.UI";

-- WindowManager lets us handles HUD toggling ("F12") and 'Escape" actions in a global manner
-- Managed windows will be made visible/invisible/closed based on those events.

-- WindowManager is a global unique instance 

-- Actions not defined in Turbine.UI.Lotro.Action
local ActionToggleDisplay = 0x100000B3;

-- local class, we don't want anyone else to reify this
local Manager = class( Turbine.UI.Window );
function Manager:Constructor()
	Turbine.UI.Window.Constructor( self );

	-- weak table so we don't prevent windows from being garbage collected
	self.windows = setmetatable({}, {__mode="k"}); 
	self.closeableWindows = setmetatable({}, {__mode="k"});
	
	-- status
	self.visibleHUD = true;
	
	-- action handler
	self:SetWantsKeyEvents(true);
	self.KeyDown = function( sender, args )
		if args.Action == ActionToggleDisplay then -- toggle display
			-- if the display was visible, save the visibility status of managedwindows
			if self.visibleHUD then
				for window, visible in pairs( self.windows ) do 
					self.windows[window] = window:IsVisible()
				end
			end
			
			self.visibleHUD = not self.visibleHUD;
			
			-- update visibility of all managed windows
			for window, visibility in pairs( self.windows ) do
				window:SetVisible( self.visibleHUD and visibility );
			end
		elseif args.Action == Turbine.UI.Lotro.Action.Escape then
			for window, v in pairs( self.closeableWindows ) do
				window:Close();
			end
			return;
		end
	end
end

-- manage a window
function Manager:ManageWindow( window, closeOnEscape )
	self.windows[window] = window:IsVisible();
	window:SetVisible( self.visibleHUD and window:IsVisible() );
	
	if closeOnEscape == nil or closeOnEscape == true then -- default = close on escape
		self.closeableWindows[window] = true;
	end
end

function Manager:IsGUIVisible()
	return self.visibleHUD;
end

-- create a unique instance of the window manager
WindowManager = Manager();
I then only have to call WindowManager:ManageWindow( window, <closeOnEscape> ) in my plugins, to have windows be made invisible/visible on F12 and be closed on ESC if <closeOnEscape> is true (or nil, default behaviour).

Note: I use weak references to 'managed' windows so as to not prevent the garbage collector from getting rid of unused windows.
__________________
Author of LIP, Bootstrap and Baruk

Last edited by Equendil : 07-13-2011 at 12:19 PM.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Skin - Plugin request wackafoo LotRO Wish List (L) 9 10-17-2011 02:26 PM
Reminder to Authors Cairenn News 0 12-14-2007 05:05 PM
To authors using reposition of the toolbar Weezl General Authoring Discussion (L) 1 07-04-2007 09:45 AM
Thanks to All Authors Frankenfrag General Authoring Discussion (L) 1 05-29-2007 06:01 PM
Reminder to Authors Cairenn Released Interfaces (L) 0 02-12-2007 06:36 PM


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


Our Network
EQInterface | EQ2Interface | Minion | WoWInterface | ESOUI | LoTROInterface | MMOUI | Swtorui