lotrointerface.com
Search Downloads


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

Reply
Thread Tools Display Modes
  #1  
Unread 10-20-2011, 08:37 AM
martin93 martin93 is offline
The Wary
 
Join Date: Oct 2011
Posts: 1
Starters guide to lua and lotro?

So I really want to get into making plugins, I have some great ideas that I'd like to implement as a plugin.

I have Visual Studio 2010 for free since I'm a student. I was excited to find this guide that uses Visual Studio. However, the links for the last 3 downloads are broken. I'm wondering and hoping you guys know of another guide I could use, or if the downloads are available somewhere else.

P.S. - I'm familiar with Visual Basic and am mid way through my first C++ class. Which language is LUA more like?

Thanks in advance! Kudos to all the devs here. You do amazing work.
Reply With Quote
  #2  
Unread 10-20-2011, 10:19 AM
Gumble Gumble is offline
The Wary
 
Join Date: Oct 2011
Posts: 1
From the extremely small amount of fiddling I've done with LUA plugins for the game (wrote an extremely basic context-sensitive quickslot bar during one of the first LUA betas) it's closer to C++ syntactically. I'm a VB.NET web dev myself, and if you're comfortable with Javascript or curly-braces in general and basic OOP design, LUA's not too difficult. I'd recommend taking a look at the source for some existing plugins and some of the wrapper/extension classes that others have made available here and on the Lotro forums (things for Ctrl-\ window positioning and the like).

Start with something basic. Just creating a windowless "listener" class that will listen for certain events (entering combat, leaving combat, dying, etc) and output some text to the chat window would be a good start. Once you're comfy with hooking into the event API you can then start playing with quickslots, equipment, and new UI elements a little more comfortably.

Good luck, and happy developing!

Hopefully some others can provide much more in-depth and sagely advice than I
Reply With Quote
  #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
  #4  
Unread 04-06-2012, 06:36 AM
Dwamur Dwamur is offline
The Wary
Interface Author - Click to view interfaces
 
Join Date: Apr 2012
Posts: 4
Necro'ing this thread.

"Writing LotRO LUA plugins for noobs" at http://forums.lotro.com/showthread.p...gins-for-Noobs has a lot of "good citizen" type advice:

- How to register events and callbacks safely, and unregister them again in your unload method
- How to get the unload method to take in the first place, reliably that is. You use an Update handler in the main window's constructor to register your unload method once the plugin has fully loaded.
- A note to please use RemoveCommand in unload, should you have added a shell command

I am going through some of the plugins I love using, and not all follow this good citizen model. How critical is it that all plugins in an apartment are good citizens? Will a plugin that did not manage to register an unload (because it doesn't use the Update trick) or does not release everything in an unload increase the likelihood of LotRO crashing when repeatedly unloading and loading?
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
LoTRO Lua noob's wish list dhmitchell23 LotRO Wish List (L) 8 12-15-2011 01:12 AM
Your Opinion on the Current State of Lua in LOTRO Merric General Authoring Discussion (L) 24 06-07-2011 12:08 PM
Strange issues with LUA plugins and Lotro F2P Europe sheen Interface Help (L) 5 11-12-2010 11:00 AM
Lua support coming to LOTRO Sparr General Authoring Discussion (L) 33 08-05-2010 07:52 PM
Lua support coming to LOTRO's UI! Dolby News 1 07-15-2010 09:36 AM


All times are GMT -5. The time now is 03:43 AM.


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