Let's Build a Elder Scrolls Online Mod - Part 1

Picture shows Jason A. Martin - Software Engineer, Indie Game Developer, Tech Evangelist, Entrepreneur.

I thought it would be fun to do a small series on how to build a simple mod for an online game. I've been an avid gamer, especially MMORPG gamer, for many years. I used to build bots in Asheron's Call, do multi-boxing, etc.

In this series, we'll be using LUA to build a simple mod for ESO. If you don't know LUA, you can check out my series Intro to Lua. If you've programmed in JavaScript before or probably most other languages, you may be able to just folow along.

The Mod

I wanted something simple and as it turns out a useful mod for ESO is out of date at the time of this writing and hasn't been updated in over a year (probably dead now). It's the perfect opportunity.

The mod we're going to build is an autoinviter. This will be super handy when trying to build up groups in zones to do things. An example would be dolmen farming.

The original intent is to keep this simmple and make a chat-line tool. Someone can just type in a slash command to turn on and off the add-on.

The Repo

I've setup a GitHub repo for the complete code here: This One Invites.

The master branch has all of the completed code while the other branches reflect the series parts. This one is branch: core.

The Gist

How this will work is the player will be able to turn on the mod and set an "action string." The mod will keep looking in the chat window and when it sees the action string typed from another player, it will send them an invite.

As an example, it's common for players to type 'x' or 'wb' in a zone to get invites for dolmen farming and world boss farming.

We're going to use the slash command /toion [string] to turn on listening and /toioff to turn it off.

Core Setup

branch: core

Each add-on you make for Elder Scrolls Online is going to follow this same pattern:

  • Create a folder that is the add-on name without spaces: ThisOneInvites
  • Create 2 files all named the same as the add-on/folder.
    • ThisOneInvites.lua
    • ThisOneInvites.txt
    • (And if you're doing GUI work) ThisOneInvites.xml

Of course use your own add-on's name here. And if you're building something more advanced, you'll end up with many filee and folders.

Let's look at these two files in more detail.


Your add-on will have a text file that will list things like files in use, API version and so forth. It's important to know that the ESO client will read this file and set things up accordingly.


## Title: This One Invites
## APIVersion: 100020


In above example we're setting the add-on Title and API version. We're also telling ESO that it needs to load ThisOneInvites.lua.

Keep in mind that the list of files are loaded in the order in which they appear.


Ok, let's jump into some core setup code.

First, we're going to namespace all of ourse data and functions. We'll also add our add-on name to it for easy reference.

-- namespace table that will hold all data and functions
ThisOneInvites = {}
ThisOneInvites.name = "ThisOneInvites"

First we're going to create a function that will be called when the add-on is loaded and player ready (more on this event in a minute).

function ThisOneInvites.OnAddOnLoaded(event, addonName)

Next, we're going to create an initialize function that will be called by this OnAddOnLoaded function.

function ThisOneInvites:Initialize()
   d("This One Invites 0.1 is loaded ...")

The d() is telling the ESO client to spit out some debug text (shown in a moment).

You may be saying why not just put the Initialize() code in the OnAddOnLoaded code and yes you could. This is a comman pattern and it's mainly this way because larger add-ons may do different things which each of these stages.

Ok sure so we're done right? No. Right now if you ran this add-on it would do nothing. We need to register and event listener to kick all of this off. Let's code that now.

EVENT_MANAGER:RegisterForEvent(ThisOneInvites.name, EVENT_PLAYER_ACTIVATED, ThisOneInvites.OnAddOnLoaded)

We're telling the ESO client that whenever the event EVENT_PLAYER_ACTIVATED is initiated we want to run our OnAddOnLoaded function.

And now if you run this addon, you'll get the loaded text like this:

This One Invites Loaded

Up Next

In the next part we'll look at how to add slash commands and read chat.

Let's Build a Elder Scrolls Online Mod - Part 2