Quantcast LoTROInterface - View Single Post - Basic Coding Help Needed
View Single Post
  #2  
Unread 01-08-2016, 11:50 PM
Garan's Avatar
Garan Garan is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Oct 2010
Posts: 269
Getting your character's name is pretty easy once you know that there is a slight oddity to the local player - Turbine decided to make it so that we have to explicitly get an instance of the local player by calling the GetInstance() method (it made some of their internal coding easier). So, to get your character's name, the first thing to do is get an instance of your character and then use the GetName() method (don't forget to import Turbine.Gameplay):
Code:
import "Turbine.Gameplay";

localPlayer=Turbine.Gameplay.LocalPlayer.GetInstance();
charName=localPlayer:GetName();
I would suggest working your way through more of the posts on the "Writing LotRO Lua Plugins for Noobs" thread as there are a lot of subjects covered in there that are pretty important, such as proper handling of event handlers to prevent stomping on other plugins' event handlers.

As to examples of handling the chat log, the best way to learn about it is to look at a plugin that accesses the chat log. The Alerter plugin deals quite a bit with the chat log. Another example is the AltViewer plugin but I don't recall which tabs are included in the published version.
Reply With Quote