We have detected that cookies are not enabled on your browser. Please enable cookies to ensure the proper experience.
Warning: JavaScript is required for some functionalities of this page. Please enable the use of JavaScript in your browser. Log In
Register My Account
Log Out (%1$s)

We have detected that cookies are not enabled on your browser. Please enable cookies to ensure the proper experience.

Warning: JavaScript is required for some functionalities of this page. Please enable the use of JavaScript in your browser.

Getting Started with Visual Studio and LOTRO UI Plugins

Greetings!

I haven't seen any unified guide/tutorial for Lua scripting of LOTRO Plugins within Visual Studio. Scripting by definition doesn't need an IDE (integrated development environment) like Visual Studio, but it's certain nice for large scripting projects for error checking and syntax highlighting.

So I decided to try it myself and then post what I discovered to help others in getting started. I haven't created a single plugin (yet), as I'm just starting out and learning the preferred and/or required structure. I'm using Visual Studio 2008 for this tutorial, but this should work in Visual Studio 2010 as well. Before we begin, grab these downloads...

Double click on the "LOTROAddon.sln" solution file from within the extracted "LOTROAddon" folder. Now you're ready to start scripting!

--=[ Notes ]=--

Creating a plugin for LOTRO's UI is fairly simple, but getting started requires a little example browsing/running, experimentation, and reference of the API Turbine released. For programmers this may come fairly easily. For others it may be an uphill battle. The best advice I can give for new authors here is to first understand how the examples that Turbine provided work.

Once you make your first window you'll get the hang of things. I highly recommend using Turbine's UI.Extensions.Window and Utils.Class in your projects so you won't have to 'reinvent the wheel'. These are included with the LOTRO plugins example from the links above..

The __init__.lua file is used to help minimize the number of imports from a package. It's not necessary, but it is very helpful for larger projects with possibly dozens or hundreds of individual lua files to import to another package (thanks to Kryso for this information)..

Images used in UI mods are all added to a folder named "Resources" in Turbine's example. I'm not sure if this is necessary, but it's a good recommendation to help you keep images separate from script files..

All images are in an extremely old, but widely-used Truevision TGA (aka: Targa) format. Many game developers use this format due to its good compression for simple images, small memory footprint to parse, and well-know use in DirectX textures. You'll need image editing software to work with these files such as Adobe Photoshop, GIMP, or Paint.Net..

All plugins for LOTRO's UI need to be copied to the Plugin director of the LOTRO user folder. Create this folder:

%USERPROFILE%\My Documents\The Lord of the Rings Online\Plugins

At the bare minimum a plugin needs an XML file with the ".plugin" extension to point to your first script file, a lua script file, the import calls within that lua file, and something to do. Example tree of a simple plugin...

Keep this in mind when using the files inside of Visual Studio. I preserved this structure for the solution file, but when making your plugin public, be sure not to include the two solution files, the project file, and the bin and obj folder..

This is intended to jump start programmers familiar with Visual Studio but not familiar with the structure of a simple LOTRO plugin. And certainly there's nothing wrong with using a simple text file editor like Notepad++ to edit lua script files for smaller plugin projects. I often skip VS and use regular text editors with some syntax highlighting for smaller projects.

Please let me know if you find any errors or oversights. I'm new to LOTRO UI plugin scripting myself, so I might have something wrong. Also, I'd love to throw in a simple "hello world" code sample (like a window with a label "hello world) right in the Main.lua file of this plugin project. If you'd like to write one, please add it to this thread and I'll include it. I'd prefer to avoid using the Turbine Extended and Util from the example plugins so that it's all self-contained in one script file.

Re: Getting Started with Visual Studio and LOTRO UI Plugins

oh thanks thanks thanks!! i'm gonna use this files right now.
I'm having a problem that i can't fix and maybe there's the solution, if anyones knows can help too.

I have one window with a button, this button opens a Window:Constructor(), then if i click on the X to close the second window, the button on the first window don't work anymore.
After a Window:Closing() event i can't re-open that window, i mean i can't find any code like Window:OpenAgain() so i need to reload the plugin all the time.

Re: Getting Started with Visual Studio and LOTRO UI Plugins

Re: Getting Started with Visual Studio and LOTRO UI Plugins

Originally Posted by cipher_nemo

[*]All projects seem to have a __init__.lua file that points to your own plugin Lua file. I'm not sure if this is required, but it's in all of Turbine's examples, so I have included it in the VS solution.

Re: Getting Started with Visual Studio and LOTRO UI Plugins

Originally Posted by Calorion

@cipher_nemo: Any chance you could release a Visual Studio 2010 version? It tries to convert, but I don't know that it's working well.

It should convert fine for Visual Studio 2010. The project file itself is very simple and the Lua for Visual Studio plugin I linked to will work with VS 2010 as well. I don't use VS 2010, so I have no way of trying it myself, sorry.

On another note, I have been toying around with LuaEdit, a separate IDE for just Lua. But it's awkward and not nearly as feature-rich as Visual Studio.

Re: Getting Started with Visual Studio and LOTRO UI Plugins

Originally Posted by cipher_nemo

Greetings!

I haven't seen any unified guide/tutorial for Lua scripting of LOTRO Plugins within Visual Studio. Scripting by definition doesn't need an IDE (integrated development environment) like Visual Studio, but it's certain nice for large scripting projects for error checking and syntax highlighting.

I downloaded and installed the VS Support installer and ran it with out errors. I use VS 2010 Pro via DreamSpark and get no plugin support after installing it. I have no syntax highlighting or error checking. When I open a LUA document it looks like a plain text file in VS.

I made sure in my installed programs list in Control Panel I had no mentions of VS Express. I reinstalled the LUA addon just in case. Opened the example project, Added References for Irony.dll, LuaGrammer.dll and LuaLanguage.dll. No syntax highlighting, no error reporting, no Intellisense.

In the VS Addon re-install I tried the Change, Repair, uninstall (with an new re-install after) and still no joy.

Any advice on how to fix this would be welcome.

(Note: I noticed in the VS Addon install it said "associate with VS 2008." This a problem?)

Re: Getting Started with Visual Studio and LOTRO UI Plugins

Did somebody try developing plugins with LuaEclipse, i.e. a Lua plugin for Eclipse? While this is nice I doubt that many people will spend lots of money (in Germany it's about 1000 $) on Visual Studio 2010 professional.

"Into the night
Soon he disappears
And in the back the attack of the black riders start" - [URL=http://www.youtube.com/watch?v=oVija7KfL80]Frodo's Dream, Van Canto[/URL]

Re: Getting Started with Visual Studio and LOTRO UI Plugins

Originally Posted by Adalas

Did somebody try developing plugins with LuaEclipse, i.e. a Lua plugin for Eclipse? While this is nice I doubt that many people will spend lots of money (in Germany it's about 1000 $) on Visual Studio 2010 professional.

I get Visual Studio 2008 with my job, so it doesn't cost a penny for me. Many developers in the US have Visual Studio, as there is no good comparison between Eclipse and VS. Eclipse can't handle .NET (due to restrictive licensing of Microsoft), but more importantly of all, both IDEs are going to be intuitive to one group of developers and completely awkward and frustrating to another.

Just try to open an existing project in each IDE and you'll see what I mean. Eclipse is very powerful, but for even simple tasks it's like using an grenade to kill an ant. In comparison, VS would probably hover somewhere between sledgehammer and hammer on that ant.

Re: Getting Started with Visual Studio and LOTRO UI Plugins

Originally Posted by cipher_nemo

It should convert fine for Visual Studio 2010. The project file itself is very simple and the Lua for Visual Studio plugin I linked to will work with VS 2010 as well. I don't use VS 2010, so I have no way of trying it myself, sorry.

Yeah, it converted fine; I just hadn't installed the C# module, so it didn't' work before. Fixed now. Now waiting on a "Hello World" code example to be included in the project.

Re: Getting Started with Visual Studio and LOTRO UI Plugins

Cipher:

Thanks again for this; I'm just now getting around to actually using it. I have a couple of questions:

1) Do you know of a good quickstart guide to Visual Studio (2010)?

2) In your example, Main.lua says, in part, 'import "Turbine.Gameplay";'. There is no such file or folder. Is this legacy from beta (or pre-November)? Or does it serve some function of which I'm unaware?