View Single Post
  #8  
Unread 09-12-2014, 01:15 PM
artouiros artouiros is offline
The Undefeated
 
Join Date: Sep 2014
Posts: 6
Quote:
Originally Posted by Garan
Actors will be in Turbine.Gameplay not Turbine.UI as they are game objects not UI objects. Additionally, the local player is a special case, a couple of years ago Turbine ran into some issues using the Turbine.Gameplay.LocalPlayer reference so they resolved this by making us get an instance of the local player by calling Turbine.Gameplay.LocalPlayer:GetInstance(). So, an Entity with a blue background in the middle of a simple test window would look like this:
Code:
testWindow=Turbine.UI.Lotro.Window()
testWindow:SetSize(400,400)
testWindow:SetVisible(true)

testEntity=Turbine.UI.Lotro.EntityControl()
testEntity:SetParent(testWindow)
testEntity:SetPosition(180,180)
testEntity:SetSize(40,40)
-- just setting the backcolor so we can see where to click
-- you would want to put an icon in the background of the control or stick a label with MouseVisible set false (so clicks pass through to the Entity) in front of it or some other fancy UI display.
testEntity:SetBackColor(Turbine.UI.Color.Blue)
-- this gets an instance of the local player and assigns it to the Entity control
testEntity:SetEntity(Turbine.Gameplay.LocalPlayer.GetInstance());
If you have AltInventory or MoorMap (or most of my plugins) you can access a Debug window - in MoorMap you simply load the plugin then use the chat command "/moormap debug on". Then you can paste the above code (or any code you want to test/execute) in the Command text and click Execute. Note that this code will run in the private MoorMap apartment and will not have access to other plugins' objects or variables (each private Apartment gets it's own Lua environment complete with a private copy of all of Turbine's objects). Even with that limitation it is a quick and easy way to dynamically test Lua code as well as providing the ability to watch variables and explore the environment. Remember to use "/moormap debug off" when you are done or MoorMap will be in debug mode whenever loaded until you do execute "/moormap debug off" (or uncheck the Debug option at the bottom of the MoorMap options window).

I would suggest you check out the thread:
https://www.lotro.com/forums/showthr...gins-for-Noobs

Its gotten buried pretty far down the forum list since I haven't published anything new there lately but it will probably answer a lot of your questions if you are new to using Lua in LotRO.
And againg thanks you. I'm really glad, that now I know how this work. I was trying to do the same, but it didin't work because I had some other Controls on top of Entity control. THanks for advice on using SetMouseVisible(false), Solved. Thanks for the link also.

Last edited by artouiros : 09-12-2014 at 01:18 PM.
Reply With Quote