lotrointerface.com
Search Downloads


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

Reply
Thread Tools Display Modes
  #1  
Unread 09-12-2014, 08:39 AM
artouiros artouiros is offline
The Undefeated
 
Join Date: Sep 2014
Posts: 6
Target yourself or Party Member

I've read all HD Turbine API docuemntation, but didn't found a method to target yourself or a party member by name.
I think there is a workaround, because I saw PartyFrames plugins makes this.
I downlaoded PartyFrames plugin and tried to get how it is realized there, but there are too much functions, i couldnt find target function.
Reply With Quote
  #2  
Unread 09-12-2014, 09:20 AM
Garan's Avatar
Garan Garan is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Oct 2010
Posts: 339
There is no way to set a target via Lua. All you can do is get the target of any Actor element using the GetTarget() function. Turbine will not expose setting a target because it would expose the game to automation and exploits.
Reply With Quote
  #3  
Unread 09-12-2014, 09:30 AM
artouiros artouiros is offline
The Undefeated
 
Join Date: Sep 2014
Posts: 6
Quote:
Originally Posted by Garan
There is no way to set a target via Lua. All you can do is get the target of any Actor element using the GetTarget() function. Turbine will not expose setting a target because it would expose the game to automation and exploits.
This plugin - http://www.lotrointerface.com/downlo...artyFrame.html makes party frames with box for each party member. By clicking on nickname of any member (including yourself) you get him in your target. I've searched every class of this plugin, but couldnt understand how it is implemented
Reply With Quote
  #4  
Unread 09-12-2014, 10:16 AM
Garan's Avatar
Garan Garan is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Oct 2010
Posts: 339
Quote:
Originally Posted by artouiros
This plugin - http://www.lotrointerface.com/downlo...artyFrame.html makes party frames with box for each party member. By clicking on nickname of any member (including yourself) you get him in your target. I've searched every class of this plugin, but couldnt understand how it is implemented
Yes, I guess I should elaborate. That's not done programmatically, it's built into the Entity control (check PartyMemberWindow.lua). As noted above, you can not set a target programmatically. You can however create an instance of a control that represents an entity which a user can then interact with - the important distinction is that the control requires user interaction and can not be controlled programmatically via Lua. That is why no matter how hard you look you will not find Lua code that sets the target, it is part of Turbine's client code that implements the Entity control. You indicated that you were trying to set the target by name, which is not what PartyFrames is doing. Hopefully that is clearer. If you wish to set the target in response to a user click on a control, that CAN be accomplished (for a limited set of targets) via the Entity control.

Last edited by Garan : 09-12-2014 at 10:19 AM.
Reply With Quote
  #5  
Unread 09-12-2014, 11:04 AM
artouiros artouiros is offline
The Undefeated
 
Join Date: Sep 2014
Posts: 6
Quote:
Originally Posted by Garan
Yes, I guess I should elaborate. That's not done programmatically, it's built into the Entity control (check PartyMemberWindow.lua). As noted above, you can not set a target programmatically. You can however create an instance of a control that represents an entity which a user can then interact with - the important distinction is that the control requires user interaction and can not be controlled programmatically via Lua. That is why no matter how hard you look you will not find Lua code that sets the target, it is part of Turbine's client code that implements the Entity control. You indicated that you were trying to set the target by name, which is not what PartyFrames is doing. Hopefully that is clearer. If you wish to set the target in response to a user click on a control, that CAN be accomplished (for a limited set of targets) via the Entity control.
Thank you for watching the code and pointing me to the Entity class. I didn't knew I could use Entity control in this way. In my question I asked for targeting by name, beucase I was sure PartyFrame does it in this way, now I know it's not.
Reply With Quote
  #6  
Unread 09-12-2014, 12:23 PM
artouiros artouiros is offline
The Undefeated
 
Join Date: Sep 2014
Posts: 6
Im sorry, but I cant figure out how ENtity control works.
Here's the code that I found
Code:
        self.select = Turbine.UI.Lotro.EntityControl();
	self.select:SetParent(self);
	self.select:SetPosition(0, 0);
	self.select:SetMouseVisible(true);
	self.select:SetEntity(actor);
	self.select:SetSelectionEnabled(true);
	self.select:SetContextMenuEnabled(true);
	self.select:SetSize(self:GetSize());
	self:SetMouseVisible(true);
I don't know how to get the actor for self.select:SetEntity(actor);
I tried setting Turbine.UI.LocalPlayer, but it didn't work. How can I get target to work?
Reply With Quote
  #7  
Unread 09-12-2014, 12:57 PM
Garan's Avatar
Garan Garan is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Oct 2010
Posts: 339
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.

Last edited by Garan : 09-12-2014 at 01:12 PM.
Reply With Quote
  #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
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
Party / Raid Display Elrigh Interface Requests (L) 0 05-17-2013 04:58 AM
How to access the party info now available? KRc Lua Programming Help (L) 16 10-05-2011 02:17 AM
Horizontal Party bars Greytail Interface Requests (L) 4 03-25-2011 10:51 AM
Getting Party member names Zyriel Interface Help (L) 4 01-20-2011 05:53 PM
Good UIs for Crafting Panel and Fellowship member layout Eoblaed Interface Requests (L) 3 07-07-2010 09:31 PM


All times are GMT -5. The time now is 10:00 PM.


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