[Tutorial] Esp-QuickEditor

The Esp-QuickEditor is an SQL based esp editing utility made by Worsas, a Lead Developer for Project Tamriel.

Download here.

How to use it:
- You need to have the newest java 8 installed.
- You can right click the jar file and select open with > java (TM) Platform SE Binary. Alternatively double-clicking the file will often automatically choose java to execute the file for you.
- Make sure to backup any file you want to edit with this program.

You can edit esm, esp and ess - files by issuing SQL-commands in the upper textarea. SQL is a language used for handling databases, which consist of one or several tables. The Esp-Quickeditor treats an esp/esm/ess file like a database with tables. Currently the following tables are featured:

idObjects - A table containing all objects with an id that are declared within the file. Except are only cells and dialogue entries.

cellObjects - A table containing all instances of objects that are physically placed within the gameworld.

dialogueResponses - A table containing all dialogue responses declared in the current file.

scripts - A table containing all scripts declared in the current file.

exteriorCells - A table containing all exterior cells declared in the current file.

masterFiles - A table containing all master files the current file depends on.

Below are further convenience/shortcut tables, I created for being able to update any kind of reference to other object

bodypartReferences - A table containing all references to body parts within armors, clothing and npcs
classReferences - A table containing all references to classes within npcs
creatureReferences - A table containing all references to npcs/creatures within levelled lists, soul data, owner data, soundgenerators.
enchantmentReferences - A table containing all references to enchantments within weapons, armor, clothing and books
factionReferences - A table containing all references to factions within npcs
fileReferences - A table containing all filepaths referenced in items, statics, groundtextures etc.
itemReferences - A table containing all references to items in containers, npcs, creatures, levelled items or key data.
scriptReferences - A table containing all references to scripts in items and activators etc.
soundReferences - A table containing all references to sound entries in regions, doors, lights and soundgenerators.
spellReferences - A table containing all references to spells in npcs, creatures or traps.

Some use-examples:

It's always a good idea to issue a SELECT command on a table first to see what it contains and what fields it has:
SELECT * FROM idObjects;

This can be done likewise with any of the other tables listed above and will show all entries of this table within the file.

Now I'd like to only see the npcs declared in my current file:
SELECT * FROM idObjects WHERE type = 'npc';

Or I want to see all objects whose id starts with _:
SELECT * FROM idObjects WHERE id = '_%';

I want to change the id of a custom activator I created in my file from myActivator to myNewActivator. So I issue the following commands:
UPDATE idObjects SET id = 'myNewActivator' WHERE id = 'myActivator';
UPDATE cellObjects SET id = 'myNewActivator' WHERE id = 'myActivator';

The first command updates the id of the base activator. The second command makes all instances of the activator point to the new activator name.

I want to change the id of an npc myNpc in my file. This requires an additional step:
UPDATE idObjects SET id = 'myNewNpc' WHERE id = 'myNpc';
UPDATE cellObjects SET id = 'myNewNpc' WHERE id = 'myNpc';
UPDATE creatureReferences SET creature = 'myNewNpc' WHERE creature = 'myNpc';

The third step ensures that any objects owned by this npc will still belong to her/him after the update (the creatureReferences - table keeps track of these additional references to npcs or creatures). Likewise, if you have a script or item or sound or whatever else whose id you want to change, make sure to make a call to the respective references table to ensure that these are updated to the new id. Another example:
UPDATE idObjects SET id = 'myNewMiscItem' WHERE id = 'myMiscItem';
UPDATE cellObjects SET id = 'myNewMiscItem' WHERE id = 'myMiscItem';
UPDATE itemReferences SET item = 'myNewMiscItem' WHERE item = 'myMiscItem';

^^ the last line will update the references in inventories, containers, levelled lists, etc.

Sometimes you have an unclean file with accidental changes to vanilla objects. You can just remove this accidental modification (you usually do this with TESAME)
DELETE FROM idObjects WHERE id='furn_bone_01';

This will delete your accidental object entry but will leave the instances of furn_bone_01 within your file unharmed (they are in the cellObjects table)

Next, I would like to adjust the position of all instances of a certain plant flora_floating in my file to make sure they are not floating anymore. Let's assume all instances are 50 units too high above the ground:
UPDATE cellObjects SET zPos = zPos-50 WHERE id = 'flora_floating';

On another day, I decide to change the container plant composition within a region examplecoast, by switching plant1 for plant2 and maybe slightly adjusting position and scale to make them fit into place.
UPDATE cellObjects SET id = 'plant2', zPos = zPos + 15, scale = scale*0.9 WHERE id = 'plant1' AND cellRegion = 'examplecoast';

I want to remove all placed objects in my file except for a certain grass plant grass_01 (I want to create a separate esp with just the grass in it, for example). So I do the following:
DELETE FROM cellObjects WHERE id <> 'grass_01';

Next thing: I want to assign a region to a cell that is very far away from 0,0 and doing it in the CS is a hit and miss - business, so I do it here with the exteriorCells - table:
UPDATE exteriorCells SET region = 'my region' WHERE gridX = 120 AND gridY = -33;

I have the adjacent exterior cell at 125,12 I accidentally edited in my claim, so I issue the command:
DELETE FROM exteriorCells WHERE gridX = 125 AND gridY = 12;

This will delete both the objects and the landscape of this cell from my file. Maybe an additional landscape- table would help, in case you just want to remove landscape changes but keep added objects to a neighbour cell. Maybe in a future version.

I want to remove dependency to a masterfile unwanted.esm from my file:
DELETE FROM masterFiles WHERE name = 'unwanted.esm';

I want to remove Almsivi Intervention from all of my npcs:
DELETE FROM spellReferences WHERE spell = 'almsivi intervention'

Regarding all the various references-tables, I'll leave it to you to figure out possible uses.

A general note: If you are a little bit familiar with SQL, you will notice that the support for different expression is quite limited at this point. There are no functions, aliases, subselects or any other advanced functions available. Only very basic SELECT, UPDATES and DELETES work. Many tables even don't allow deletions on them and there are many columns that cannot be updated. INSERTs are only possible with the cellObjects- and masterFiles table at the moment.

Tutorial copied from here, and could be rewritten in the future.