Lua Scripting

From Lotro-Wiki.com
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Introduction

Lua scripting is a method for extending and customizing the game user interface by writing scripts in the Lua programming language.

Plugin

A plugin is a user interface extension written in the Lua scripting language.

API

The Lua scripts interface with the LOTRO client software through an Application Programming Interface (API) which grants limited access to game state data, enables interaction with the game user interface and provides utility functions.

About Lua Scripting

Lua UI Plugins in LOTRO

From Lua UI Plugins in LOTRO

Original posted by Narrel on Jul 19 2010 01:50 PM

With the breaking news of Lua’s introduction into The Lord of the Rings Online, we wanted to give you a brief history of how this system came about, what state it is in, and where we want it to go.

History:

To start, I will say that the primary driver behind introducing UI plugins is this: no single version of a UI element will ever be ideal for all players everywhere. What one player loves about part of the UI can send the player standing next to them reeling into a frothing rage of frustration. Knowing this, a small group of us got together last year and began investigating the possibility of adding a UI scripting system.

As several other games have used Lua successfully for UI scripting, we decided to look into it and were quickly able to get a prototype Lua UI scripting interface into our engine. Since then, we have gradually continued to develop the system alongside our other initiatives. Today, we are in the process of Beta testing the Lua UI scripting interface on our closed Beta preview servers.

Current State:

Many of you have been asking what this means when it goes live. This system has been implemented to allow players to override existing elements in the graphical user interface. The functionality available in its current state is small in scope but introduces a lot of fun UI possibilities. Our Lua-based UI plugin system exposes functionality through chunks of functionality referred to as “APIs.” In its current state, we have implemented the following APIs:

  • Basic UI element creation (such as windows, text boxes, buttons, etc.)
  • Quickslot information (allowing for additional quickslot arrangements for skills, items, etc.)
  • Inventory UI information
  • Your character’s morale/power information as well as what effects you currently have on you

To clarify, our implementation of Lua scripting in our game is not a macro-able/BOT-able interface. The system does not allow automated input such as mouse-clicks or macroing, nor does it allow automatic skill execution. Any UIs created through Lua scripts will still require human interaction to use.

We intend to continue heavy Beta testing on the Lua UI scripting system on the private test servers. There are several internal hurdles that remain to be cleared before the initial launch of the system and it is not yet guaranteed that “Lua in LOTRO” will launch in the Volume 3 Book 2 (F2P launch) timeframe. Much like our initial launch of QuestGuide or DX10, we will likely launch the feature as a public “beta” stage/“work in progress” as we continue to solidify and expand the initial functionality.

The Future:

As for our future plans for this, our intention is to continue to add more API functionality after the initial launch. For example, some of the popular requested APIs are: target, fellowship, and raid vitals, as well as vault functionality similar to the current API’s inventory functionality. The ultimate goal for this system is to allow players to legitimately customize their UI as a largely upgraded version of our current long-standing “UI skinning” tech. It’s all about the UI and letting players change it so the information we already expose in our current UI can be presented in different aesthetic fashions.

I hope this information clarifies what “Lua scripting” means for The Lord of the Rings Online. As we come closer to the actual launch, we will provide more information into the specifics of the system. We are very excited about this feature and look forward to the day when it goes live allowing players to have a much more customizable experience with our graphical interface.

Introduction to Lua UI scripts

From Introduction to Lua UI scripts

Original posted by Narrel on Sep 07 2010 04:39 PM

Welcome to Lua UI scripting in LOTRO! To get you started, we have some handy resources for you.

First, for those of you that wish to familiarize yourself with the system to create scripts of your own, we have our complete API documentation in a series of HTML pages including all currently available functionality and code example snippets. For now, the API is in 7-zip format and is available for download here. Once you have unzipped it, open the folder and open index.html with your favorite browser to get started. We will hopefully get this hosted as part of our websites soon. The documentation can be expanded anywhere in the file system. Be sure to preserve the folder structure of the archive.

Second, we have some basic example scripts that players can use as examples for writing their own scripts or to use to get a feel for what Lua is capable of in our UI. These examples are in 7-zip format and available for download here. You'll want to unzip the file into your "My Documents\The Lord of the Rings Online" folder.

Please note: these files had to be packaged in .7z format. Many unzip tools support this file format. If yours does not (or if you need an unzipping program) download 7zip. It is a free unzipping program that supports this format.

The folder mentioned above is where screenshots and chat logs are stored. The location varies between Windows versions, and is user dependent. Be careful that the .7z archive folder structure is preserved and the content is placed in a folder named Plugins in this folder.

How to use Lua UI plugins

From: How to use Lua UI plugins

Original posted to forums-old.lotro.com by Narrel Sep 09 2010 07:12 AM

Howdy folks, just wanted to give you a quick rundown of how everyone can make use of Lua UI plugins within LOTRO. This is not a walk-through of how to create a plugin, this is just a walk-through of how to make use of existing plugins.

Step 1, Exposing the plugins to your client:

Navigate to your documents folder for The Lord of the Rings Online (for Windows XP users, this is usually "C:\Documents and Settings\<your user name>\My Documents\The Lord of the Rings Online" while for Windows Vista\7 Users, this is usually "C:\Users\<your user name>\Documents\The Lord of the Rings Online").

This is the folder where screenshots and chat logs are placed.

Create a folder named "Plugins" inside of this folder. Place all plugins inside of this new folder (most plugins are organized into their own folder meant to go inside of the main "Plugins" folder).

Step 2, Viewing the list of available plugins in game:

In your client (once you have dropped the plugins into your new plugins directory), type the following command in your chat window to make sure the client has an up-to-date list of your available plugins:

/plugins refresh

Next, type the following command to dump the list of all currently available plugins to your chat window:

/plugins list

The list will show you all plugins that your client is currently capable of loading as well as any plugins you already have loaded. If the plugins you want to use are not listed there, make sure the plugins are properly located in the "Plugins" folder created in step 1. If they are still not showing in the list, try restarting your LOTRO client.

Step 3, Loading your plugins:

Please note: You will have to do this step EVERY time you log in your character if you want to run your plugins. For the "BETA" release of the Lua plugin system, plugins cannot be set to automatically load upon logging in*

Once the plugins you want to load are displaying in the list of available plugins seen in step 2, it is now time to load your plugin! To load a plugin, use the following command:

/plugins load <Plugin Name>

replace <Plugin Name> with the desired plugin's name as listed in the available plugins list from step 2

If no errors are reported in your chat window, then you have successfully loaded the plugin and can now begin using/enjoying it! If script errors are reported in the chat window, then report them to the author of the plugin you tried to load.

To unload plugins:

Plugins are automatically unloaded when you log out but if for any reason you would like to manually unload a plugin you have running, you must use the unload command to unload all of your running plugins:

/plugins unload

Please note, this command unloads ANY plugins you have running so at this stage of the system, once that command is used, you must then individually re-load any of the plugins you want to continue running.

Last edited by Narrel; Sep 09 2010 at 09:28 AM.

Post LOTRO UI Customization Heart Monitoring

From LOTRO UI Customization Heart Monitoring

Originally posted by Narrel on Jun 24 2011 05:25 PM

Well, I know it may not seem that way, but as audibly faint as it has been for so long, I can assure you that the pulse of Lua scripting and UI customization in general remains steady. As it was at its birth, Lua remains a pet (side) project of our little "Lua crew" which has both positives and negatives. The positive being that it remains near and dear to our hearts and we have no intention to let it simply die. The negative being the limited time/resources we have available to dedicate to it. So while updates have been frustratingly few and far between for you folks, I want to assure you all that we have not forgotten Lua or, for that matter, all of you.

We've all certainly been hard at work (and very focused) on the upcoming Isengard release and we have still spent what free time we could getting some Lua updates ready, too. While I am not at liberty to be more detailed at this point, I can assure you that the future does include continued Lua API updates. Please remain patient with us and as we are able to discuss things more openly as the Rise of Isengard release grows ever closer, I assure you that we will update you with more details.

As for something I CAN be more specific about, I have inherited our ol' friend the skinning system now as well so I will personally make sure that you do not go another major release without getting the latest skinning library uploaded. So, barring me having an unfortunate meeting with a bus or other large vehicle beforehand, you'll at least have an accurate skinning library .zip file posted circa Isengard.

So, in closing, we're still alive here and very busy but we'll keep you updated as time goes on and we become able to share more details. Thank you immensely for your continued patience and vocal support for the continuation of the Lua initiative,

-Nar

(and ForsakenArcher and Agiclaw)

Using Plugins

The easiest way to use plugins is to start by installing a plugin manager plugin. A plugin manager proved a wrapper or graphic user interface to the basic /plugin command, making it easier to use plugins.


Developing Plugins

For those with the skill and inclination to develop their own LOTRO plugins:

  • Read the Lua documentation
  • Read the Turbine LOTRO API documention
  • Review the source code for Turbine's sample plugins
  • Review the source code for other plugins
  • Design and develop your own plugin

Code Snippets

Automatic client language detection:

   local _locale = "fr";
   if Turbine.Shell.IsCommand("hilfe") then
       _locale = "de";
   elseif Turbine.Shell.IsCommand("help") then
       _locale = "en";
   end

or

   local _locale = "en";
   if Turbine.Shell.IsCommand("hilfe") then
       _locale = "de";
   elseif Turbine.Shell.IsCommand("aide") then
       _locale = "fr";
   end

External Links

The Programming Language Lua

Lua Scripting is now available in LOTRO! Please visit the LOTRO LOTRO Lua Scripting Forum for full information on Lua and the terms, conditions and limitations of our Beta implementation. Please be aware that Lua Scripting is still considered to be in Beta. As a result we do not provide support for Lua or plug-ins.

Lua UI Plugins in LOTRO

Introduction to Lua UI scripts

How to use Lua UI plugins

Writing LotRO Lua Plugins for Noobs