Quantcast
Lua Vitals UI : Beginner Help - LoTROInterface
lotrointerface.com
Search Downloads


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

Reply
Thread Tools Display Modes
  #1  
Unread 10-06-2022, 07:59 AM
Flan Flan is offline
The Wary
 
Join Date: Oct 2022
Posts: 4
Lua Vitals UI : Beginner Help

Hi i am trying to make a vitals UI.
But i cant for the life of me figure out a way to make it so that when i right click the vitals it gives me the same options as the regular ui.


This problem came to me when testing and i wanted to leave an instance but it wouldnt let me so back i went into visual studio to see what i could do to call the basic right click down option menu like on the basic vitals ui that the default game gives.

I am editing from the vitals example in turbine examples and editing off that for personal use and the only options are layout left to right and right to left

Any help would indeed be very grateful!
Reply With Quote
  #2  
Unread 10-06-2022, 11:20 AM
Garan's Avatar
Garan Garan is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Oct 2010
Posts: 326
I haven't played with it in a while, but what you want is a Turbine.UI.Lotro.Entity control. For some reason, my docs are missing the GetEntity and SetEntity methods of the control, but they return/take an Entity object. In your case you want to pass the local player, so:
myEntity=Turbine.UI.Lotro.Entity()
myEntity:SetEntity(Turbine.Gameplay.LocalPlayer:Ge tInstance())

-- note, you obviously have to set the control on a window and size it properly, etc.
The Entity control will provide context sensitive menus based on which entity is passed to SetEntity()
Reply With Quote
  #3  
Unread 10-06-2022, 12:02 PM
Flan Flan is offline
The Wary
 
Join Date: Oct 2022
Posts: 4
Hey Garan
Thank you for your reply!

I had a thorough look through your docs and couldnt find a solution.

If i use the Get and Set entity does that overwrite the already implemented layout when pressing right click or would i have to delete those lines and add your code you posted?
Reply With Quote
  #4  
Unread 10-06-2022, 12:04 PM
Flan Flan is offline
The Wary
 
Join Date: Oct 2022
Posts: 4
Also do i add that in main or do i have to make another class or is it just refrencing turbine.ui that is already imported in the init?
Reply With Quote
  #5  
Unread 10-06-2022, 12:15 PM
Flan Flan is offline
The Wary
 
Join Date: Oct 2022
Posts: 4
Quote:
Originally Posted by Garan
I haven't played with it in a while, but what you want is a Turbine.UI.Lotro.Entity control. For some reason, my docs are missing the GetEntity and SetEntity methods of the control, but they return/take an Entity object. In your case you want to pass the local player, so:
myEntity=Turbine.UI.Lotro.Entity()
myEntity:SetEntity(Turbine.Gameplay.LocalPlayer:Ge tInstance())

-- note, you obviously have to set the control on a window and size it properly, etc.
The Entity control will provide context sensitive menus based on which entity is passed to SetEntity()
So this is the problem i have ran into!
... Rings Online\Plugins\TurbinePlugins\Vitals\Main.lua:14: attempt to call field 'Entity' (a nil value)

I am completely new to lua programming and definitely plugins so if you could help me more it would be appreciated!

I just want the Its You "name"!!!!! option menu

Last edited by Flan : 10-06-2022 at 12:48 PM.
Reply With Quote
  #6  
Unread 10-06-2022, 05:21 PM
Garan's Avatar
Garan Garan is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Oct 2010
Posts: 326
Quote:
Originally Posted by Flan
So this is the problem i have ran into!
... Rings Online\Plugins\TurbinePlugins\Vitals\Main.lua:14: attempt to call field 'Entity' (a nil value)

I am completely new to lua programming and definitely plugins so if you could help me more it would be appreciated!

I just want the Its You "name"!!!!! option menu
Oops. My error - I didn't pay attention, the forums added a space in the name of the control and changed the 'C' to lowercase. I hate when forums think they know better... grrrr
Anyway, the control is
Code:
Turbine.UI.Lotro.EntityControl()
I erroneously copied just the Turbine.UI.Lotro.Entity in my example. It should have been:
Code:
myEntity=Turbine.UI.Lotro.EntityControl()
myEntity:SetEntity(Turbine.Gameplay.LocalPlayer:GetInstance())
You need to explicitly include each part of the namespace, so you should have:
Code:
include Turbine
include Turbine.UI
include Turbine.UI.Lotro
usually in your main lua file.

I would recommend that you find an existing plugin that uses an EntityControl and see how it is used in practice. There are tons of other plugins and I am sure at least one uses an EntityControl. I would start by searching plugins with the key word 'Vitals' and download a few and see how the authors implement the controls. Since Lua is a scripting language, the best way to learn about it is to dismantle existing samples.
Reply With Quote
  #7  
Unread 10-06-2022, 05:24 PM
Garan's Avatar
Garan Garan is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Oct 2010
Posts: 326
Quote:
Originally Posted by Flan
Hey Garan
Thank you for your reply!

I had a thorough look through your docs and couldnt find a solution.

If i use the Get and Set entity does that overwrite the already implemented layout when pressing right click or would i have to delete those lines and add your code you posted?
By "my docs" I was referring to my local copy of the API docs which can be downloaded from lotrointerface. I think the latest version is at:
https://www.lotrointerface.com/downl...mentation.html

GetEntity will return the Entity object that is currently assigned to the control. SetEntity sets the Entity for which the control should provide a context sensitive menu. The control uses the underlying client object to determine the type of entity and displays the correct menu when you right click the control.

Last edited by Garan : 10-06-2022 at 05:26 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
Lua Beginner has some questions Hamkaas Lua Programming Help (L) 6 06-15-2016 03:43 PM
Festival vitals Oakeman XML modification help (L) 5 05-14-2013 09:53 PM
Improved Vitals Elbareth Interface Requests (D) 11 07-31-2010 01:41 PM
Vitals Dretchen General Authoring Discussion (L) 2 05-17-2007 04:41 PM
beginner question for letterboxbottom. Pro Graphics modification help (L) 2 05-02-2007 07:49 PM


All times are GMT -5. The time now is 06:18 AM.


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