Skyrim Mod:SkyProc/How to List/ImportMods

The UESPWiki – Your source for The Elder Scrolls since 1995
Jump to: navigation, search
SkyProc Logo.png

How To[edit]

Import all active mods in a user's load order[edit]

In general, the SkyProc Starter project will handle importing for you. Just specify the import requests. This should suffice for 95% of SkyProc coders.


If you for some reason want to manually import yourself (perhaps you're using a from-scratch project):

SPImporter importer = new SPImporter();
importer.importActiveMods();

This calls importer's importActiveMods() function to load all active mods and all of their GRUPs, and then adds them into the database.

Then create a merger to flatten the records from the database.

Mod merger = new Mod("MergerTmp.esp");
merger.addAsOverrides(SPGlobal.getDB());


Import a single mod[edit]

SPImporter importer = new SPImporter();
importer.importMod(new ModListing("Skyrim.esm"), SPGlobal.pathToData);

This line calls importMod() to load only the mod that matches the ModListing and all of its GRUPs, and then adds it into the database.

The mod can then be accessed inside the SPGlobal database, as well as the records contained in it.

Note: You have to specify the path to the Data/ folder, which should usually always be the same as SPGlobal.pathToData which you should have set earlier. This function also throws the BadMod exception, in case anything goes wrong finding/importing the function, so be prepared to handle the exception.


Import a set of specific mods[edit]

ArrayList<ModListing> modsToImport = new ArrayList<ModListing)();
modsToImport.add(new ModListing("Skyrim.esm"));
modsToImport.add(new ModListing("anotherMod.esp"));

SPImporter importer = new SPImporter();
importer.importMods(modsToImport, SPGlobal.pathToData);

This line calls importMods(), which in turn calls importMod() on each ModListing on the list, and then adds them into the database.

The mods can then be accessed inside the SPGlobal database, as well as the records contained in them.


Related Articles[edit]