Quantcast Any way to overload or replace turbine.ui methods with my own? - LoTROInterface
VGInterface.com
Search Downloads


Go Back   LoTROInterface > LotRO > Developer Discussions > Lua Programming Help (L)

Reply
 
Thread Tools Display Modes
  #1  
Unread 09-20-2010, 01:23 PM
crazygonuts crazygonuts is offline
The Wary
 
Join Date: Sep 2010
Posts: 2
Any way to overload or replace turbine.ui methods with my own?

I can't read any of the fonts in game because they're too small, so I'm trying to write a small little mod to increase their size. The simplest way I can see to do that would be if I could replace SetFont in TextBox and just have it pick a larger font than the one passed in. It seemed like a longshot but I figured I might as well ask and see if there was a way I could replace that method or if those are completely inaccessible. Thanks for any replys.
Reply With Quote
  #2  
Unread 09-20-2010, 05:15 PM
derk derk is offline
The Wary
 
Join Date: Sep 2010
Posts: 3
I had to use this little trick myself to do something like you want, however this example is from memory and I haven't checked if it works. You will have to test yourself and check wat kind of arguments go into the functions but you should get the general idea:

Code:
function SomeClass:init()
	-- hook the SetFont and SetText functions
	self.prevLabelSetFont = Turbine.UI.Label.SetFont;
	Turbine.UI.Label.SetFont = function ( --args? )
		self.prevLabelSetFont( Turbine.UI.Lotro.Font.TrajanPro28 )
	end
	self.prevLabelSetText = Turbine.UI.Label.SetText;
	Turbine.UI.Label.SetText = function ( --args? )
		self.prevLabelSetFont(  Turbine.UI.Lotro.Font.TrajanPro28 )
		self.prevLabelSetText( --any args)
	end
	
	-- hook any other functions that don't inherit from Label:SetText and Label:SetFont ( if there are any )
	--  like: Turbine.UI.Window.SetText

	-- above only sets on the SetFont and SetText functions, still need to set existing labels 	
	-- set a flag on all Turbine.UI.Label:
	Turbine.UI.Label._IsLabel = true;
	
	-- recusively check the _G table for all loaded tables
	self:enum_tables( _G, { } );

end

function SomeClass:enum_tables( t, seen )
	seen[t] = true;
	for k,v in pairs(t) do
		if ( type(v) == "table" and not seen[v] ) then
			-- here check our flag
			if ( v._IsLabel ) then
				v:SetFont( Turbine.UI.Lotro.Font.TrajanPro28 )		
			else
				self:enum_tables( v, seen );
			end
		end
	end
end
Also I don't know if everything inherits from Turbine.UI.Label and in some class making/overloading constructions it doesn't work (like turbine's TheOneBag example)
Reply With Quote
  #3  
Unread 09-20-2010, 06:40 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 crazygonuts
I can't read any of the fonts in game because they're too small, so I'm trying to write a small little mod to increase their size. The simplest way I can see to do that would be if I could replace SetFont in TextBox and just have it pick a larger font than the one passed in. It seemed like a longshot but I figured I might as well ask and see if there was a way I could replace that method or if those are completely inaccessible. Thanks for any replys.
Here's the problem. Unlike some other games, LotRO's interface isn't written in Lua, so the Lua API cannot do anything with existing LotRO UI elements. You can add as many different windows/panels etc, and duplicate existing LotRO UI elements; but even the native Turbine.UI.Lotro elements are the same thing - replications of the existing UI elements. The easiest way to see this is just by creating a Turbine.UI.Lotro.Window. You'll notice that the title bar does not behave the same way as actual Lotro Windows do. It will continue to expand, regardless of how big the window is - even though the title bar of "real" windows only get to about 255px wide.

So short answer? Nothing you can do in Lua, or will ever be able to, will ever change a single existing UI element in the game. The best we'll ever be able to do is to override the display of such elements, and use the necessary data to display that element how we would like. The implementation of Lua in LotRO is more or less its own separate entity, getting only information the game itself is set up explicitly to give.
Reply With Quote
  #4  
Unread 09-21-2010, 06:42 AM
derk derk is offline
The Wary
 
Join Date: Sep 2010
Posts: 3
Ah right, I overlooked the fact that he wanted to change the existing ingame menus
Reply With Quote
  #5  
Unread 09-21-2010, 11:16 PM
crazygonuts crazygonuts is offline
The Wary
 
Join Date: Sep 2010
Posts: 2
Yeah, that's what I had figured but I had to ask just in case. Thanks for confirming it for me though.

Quote:
Originally Posted by Digital_Utopia
Here's the problem. Unlike some other games, LotRO's interface isn't written in Lua, so the Lua API cannot do anything with existing LotRO UI elements. You can add as many different windows/panels etc, and duplicate existing LotRO UI elements; but even the native Turbine.UI.Lotro elements are the same thing - replications of the existing UI elements. The easiest way to see this is just by creating a Turbine.UI.Lotro.Window. You'll notice that the title bar does not behave the same way as actual Lotro Windows do. It will continue to expand, regardless of how big the window is - even though the title bar of "real" windows only get to about 255px wide.

So short answer? Nothing you can do in Lua, or will ever be able to, will ever change a single existing UI element in the game. The best we'll ever be able to do is to override the display of such elements, and use the necessary data to display that element how we would like. The implementation of Lua in LotRO is more or less its own separate entity, getting only information the game itself is set up explicitly to give.
Reply With Quote
  #6  
Unread 09-22-2010, 12:14 AM
daimon's Avatar
daimon daimon is offline
Super Moderator
LOTROInterface Super Mod
Interface Author - Click to view interfaces
 
Join Date: Aug 2007
Location: Finland
Posts: 466
The simplest way might be trying to lower your gaming resolution, in case if you're using some huge 2560·XXXX or something...
__________________
~·~ DaimonUI ~·~
avatar by Humon
Reply With Quote
  #7  
Unread 09-22-2010, 02:12 PM
katarn0 katarn0 is offline
The Wary
 
Join Date: Sep 2010
Posts: 1
I need to get in game, but I remember there being a way to change the ui size and I thought font size was included in that. It may only be the font size of the chat window though, so please don't quote me on that until I get home tonight and check it out.
Reply With Quote
  #8  
Unread 09-22-2010, 09:07 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 katarn0
I need to get in game, but I remember there being a way to change the ui size and I thought font size was included in that. It may only be the font size of the chat window though, so please don't quote me on that until I get home tonight and check it out.
There is, but the resizing is done by "zooming", giving you about the same result as if you took a 15px x 15px image, and blew it up 200%. It would be bigger, sure - but it would also be exceptionally blurry.
__________________

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
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
Help with Turbine store button Krakenheim Interface Help (L) 5 09-10-2010 08:31 AM
Turbine lotro bug of quickslot Bar 3, anyone else notice it? Bachihihii Interface Help (L) 3 02-01-2010 09:01 AM
Turbine Advisory: Protect Your Private Information Cairenn News 0 09-11-2007 12:20 AM
Turbine Opens a Preview Server Cairenn News 0 05-26-2007 12:40 PM
Turbine Announces Lorebook Preview Released Today! Cairenn News 0 05-10-2007 02:54 PM


All times are GMT -5. The time now is 08:43 PM.


Our Network
EQInterface | EQ2Interface | Minion | WoWInterface | VGInterface | LoTROInterface | MMOInterface | Swtorui