View Single Post
  #3  
Unread 10-20-2011, 10:21 AM
Garan's Avatar
Garan Garan is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Oct 2010
Posts: 340
Those last three links were to beta samples that are no longer valid. The current Turbine samples can be found at: http://content.turbine.com/sites/lot..._LuaPlugins.7z
note that they are in a 7z compressed archive. You can download a free unzip program from http://www.7-zip.org/

The latest Turbine API documentation is on LoTROInterface at:
http://www.lotrointerface.com/downlo...mentation.html

As to the language, it is a scripting language, much like VBScript. The language guide I used to learn Lua comes from lua.org http://www.lua.org/manual/5.1/

One of the biggest pitfalls for inexperienced developers is depending too much on the Turbine samples. Those plugins should be treated strickly as a starting point, not as a required foundation - if you use any of the source files from the samples such as class.lua, create a copy and include it in your own project, don't just reference it from the Turbine folder. That way you won't have any issues if the person who wants to use your finished project either doesn't have the Turbine samples or has a different version (they changed in some significant ways from beta and original live versions to the current versions).

As with many other languages, the best way to learn Lua is to take a simple working sample and dissect it. Learn how objects are created and how to manipulate them to do what you want. Once you are comfortable playing with existing plugins, you should really read as much of the http://forums.lotro.com/forumdisplay...amp-Discussion forum as possible as this is where authors have documented issues that they have spent time (in some cases many hours) exploring as well as some interesting and useful undocumented features such as missing enumeration values, undocumented fonts, and undocumented methods such as my favorite, the elusive but incredibly useful :SetStretchMode() method.

As to tools, there's nothing wrong with using Visual Studio, but it's a bit like using a hand grenade to kill a mosquito. Notepad and Paint.Net will suffice. No complex tools are really needed. I have found that in-game debugging can be useful at times so I developed my debug.lua class that can be added to plugins and when displayed will allow you to interactively examine all of the objects and values (a good way to find those previously mentioned undocumented methods) as well as interactively entering code and modifying your plugin on the fly.

There are two fairly important issues that you should be aware of, the first deals with how to implement event handlers without stomping on other plugins and is at: http://forums.lotro.com/showthread.p...nce-and-events
The second deals with handling international character sets in saved data and has a couple of different solutions, I implement a slightly altered version of a patch originally published here by Vindar: http://www.lotrointerface.com/downloads/info456.html

Last edited by Garan : 10-20-2011 at 10:33 AM.
Reply With Quote