Events

One way an extension integrates with Vortex is by reacting to global events triggered by the main application. That way your extension can become part of the regular workflow in the application, e.g. doing work every time Vortex deploys mod.

Contributing

The event lists below are generated from this data file: https://github.com/Nexus-Mods/vortex-api/blob/master/docs/_data/events.yml

If you want to improve the documentation, please fork this repo and make a pull request with your improvements.

Interacting with events

There are two different ways we trigger events:

Further we divide the list into “events” and “commands”, with “events” being events that the Vortex core triggers and the extension is expected to catch to react to them and “commands” being events that extensions are supposed to trigger and Vortex core or another extension reacts to.

In order to have your extension respond to an event you can use the following:

context.api.events.on('eventName', callback); // fire-and-forget

context.api.onAsync('eventName', callback); // async

To emit an event (or command) yourself use the following:

context.api.events.emit('eventName', callback); // fire-and-forget

context.api.emitAndAwait('eventName', callback); // async

Event List

mods-enabled

Namemods-enabled
Parameters
mods string[]
enabled boolean
gameId string
Function api.events.on
Triggeredwhenever mods got enabled or disabled in the current profile

gamemode-activated

Namegamemode-activated
Parameters
gameId string
Function api.events.on
Triggeredwhenever the active game was changed (also on start-up)

profile-will-change

The enqueue function can be used to return a Promise which needs to be fulfilled before the profile may be changed. The change can not be canceled though because we can’‘t know if/how previous changes can be rolled back

Nameprofile-will-change
Parameters
newProfileId string
enqueue (cb: () => Promise<void>) => void
Function api.events.on
Triggeredbefore Vortex changes profiles (potentially to a different game), usually triggered directly by the user

will-deploy

Namewill-deploy
Parameters
profileId string
oldDeployment { [modType: string]: IDeployedFile[] }
Function api.onAsync
Triggeredbefore Vortex deploys mods

did-deploy

Namedid-deploy
Parameters
profileId string
newDeployment { [modType: string]: IDeployedFile[] }
Function api.onAsync
Triggeredafter Vortex finishes a deployment

will-remove-mod (Requires Vortex >= 1.3.15)

Namewill-remove-mod
Parameters
gameId string
modId string
Function api.onAsync
Triggeredbefore a mod is removed (irrespective of whether it was enabled in the active profile or not)

did-remove-mod (Requires Vortex >= 1.3.15)

Namedid-remove-mod
Parameters
gameId string
modId string
Function api.onAsync
Triggeredafter a mod is removed (irrespective of whether it was enabled in the active profile or not)

added-files

Nameadded-files
Parameters
profileId string
newFiles Array<{ filePath: string, candidates: string[] }>
Function api.onAsync
Triggeredwhen Vortex discovers new files were created in the games mod folder that may belong to one of the mods managed by Vortex. The "candidates" lists the ids of mods that _may_ be where the file belongs.

mod-enabled

Namemod-enabled
Parameters
profileId string
modId string
Function api.events.on
Triggeredwhen a mod got enabled

mod-disabled

Namemod-disabled
Parameters
profileId string
modId string
Function api.events.on
Triggeredwhen a mod got disabled

mod-content-changed

Namemod-content-changed
Parameters
gameId string
modId string
Function api.events.on
TriggeredVortex determined that files it deployed were modified or removed

will-purge

Namewill-purge
Parameters
Function api.events.on

did-purge

Namedid-purge
Parameters
Function api.events.on

Command List

Commands as such are conceptually very similar to regular api functions but allow multiple (or no) listeners. This loose coupling makes them more appropriate for situations where an extension interacts with another extension where you can’t/don’t want to rely on the other extension actually being loaded.

start-download-url

Namestart-download-url
Parameters
url string
fileName string
Function api.events.emit

show-balloon

Nameshow-balloon
Parameters
title string
content string
Function api.events.emit

deploy-mods

Namedeploy-mods
Parameters
callback (err: Error) => void
profileId ? string
progressCB ? (text: string, percent: number) => void
Function api.events.emit

deploy-single-mod

Description: You can not usually deploy a single mod safely because it would ignore conflicts and such There are very few exceptional situations where this is possible

Namedeploy-single-mod
Parameters
gameId string
modId string
enable ? boolean
Function api.emitAndAwait

purge-mods-in-path

Description: Purge a specific mod type# overriding the deployment target. This is intended to be used to clean up when an upgrade to a game extension changed the way mods get deployed such that the deployment target the new version would dynamically generate doesn’‘t match where the old version deployed to’

Namepurge-mods-in-path
Parameters
gameId string
modType string
modPath string
Function api.emitAndAwait

purge-mods

Namepurge-mods
Parameters
allowFallback boolean
callback (err: Error) => void
Function api.events.emit

start-install

Description: start installing an archive as a mod

Namestart-install
Parameters
archivePath string
callback (err: Error, modId: string) => void
Function api.events.emit

start-install-download

Description: start installing a file downloaded through vortex as a mod

Namestart-install-download
Parameters
downloadId string
allowAutoEnable boolean
callback (err: Error, modId: string) => void
forceInstaller string
Function api.events.emit

remove-mod

Description: remove a mod

Nameremove-mod
Parameters
gameMode string
modId string
callback (err: Error) => void
Function api.events.emit

create-mod

Description: create an empty mod

Namecreate-mod
Parameters
gameMode string
mod IMod
callback (err: Error) => void
Function api.events.emit

update-categories

Nameupdate-categories
Parameters
gameId string
categories { [id: string]: ICategory }
isUpdate boolean
Function api.events.emit

check-mods-version

Namecheck-mods-version
Parameters
gameId string
mods { [id: string]: IMod }
forceFull boolean
Function api.events.emit

nexus-download

Description: Download a file from Nexus Mods

Namenexus-download
Parameters
gameId string
nexusModId number
fileId number
Function api.emitAndAwait

endorse-mod

Description: Endorse a mod on Nexus Mod

Nameendorse-mod
Parameters
gameId string
modId string
endorsedStatus EndorsedStatus
Function api.emitAndAwait

endorse-nexus-mod

Description: Endorse a mod on Nexus Mods. Unlike with “endorse-mod”, in this command you specify the nexus mod id so technically the mod doesn’t have to be installed but obviously the site will refuse the endorsement if the user has never downloaded the mod.

Nameendorse-nexus-mod
Parameters
gameId string
nexusModId number
version string
endorsedStatus EndorsedStatus
Function api.emitAndAwait

submit-feedback

Namesubmit-feedback
Parameters
title string
message string
hash string
feedbackFiles string
anonymous boolean
callback string
Function api.events.emit

mod-update

Description: Instruct Vortex to update a mod which is showing an update pending.

Namemod-update
Parameters
gameId string
modId string
fileId string
Function api.events.emit

open-mod-page

Description: Open the website for the mod. The “source” parameter specifies where we got the mod from, which is required to figure out where the site is. Without extensions, only “nexus” is supported as the sourc.

Nameopen-mod-page
Parameters
gameId string
modId string
source string
Function api.events.emit

import-downloads

Description: Instructs Vortex to copy the listed files into the Vortex downloads folder (for the active game)

Nameimport-downloads
Parameters
filePaths string[]
Function api.events.emit

remove-download

Description: Delete the specified download

Nameremove-download
Parameters
downloadId string
Function api.events.emit

pause-download

Description: Pause a download

Namepause-download
Parameters
downloadId string
Function api.events.emit

resume-download

Description: Resume the specified download. The callback will be called once the download finishes or failed.

Nameresume-download
Parameters
downloadId string
callback ? (err: Error, downloadId: string) => void
Function api.events.emit

start-download

Description: Start a download.

Namestart-download
Parameters
urls string[] Multiple urls can be specified to download from multiple sources or to have a fallback if one doesn't work, however as of Vortex 1.3 we only use the first.
modInfo any Meta information to be stored with the archive
fileName ? string Initial file name to use for the file download. If unset, will be deduced from the url
callback ? (err: Error, id: string) => void
redownload ? RedownloadMode Decides how Vortex acts if a file with the same name has already been downloaded.
Function api.events.emit

trigger-test-run

Description: Trigger validity checks that find problems with the setup of Vortex or the game.

Nametrigger-test-run
Parameters
eventType string
delay number debouncer timeout to prevent the check from running too frequently, harming performance
Function api.events.emit

install-extension

Description: Install a Voretx extension

Nameinstall-extension
Parameters
extensionInfo IExtensionDownloadInfo
Function api.emitAndAwait

browse-for-download

Description: Opens an embedded browser to the specified url that closes as soon as the user selects a file download

Namebrowse-for-download
Parameters
url string
instructions string
Function api.emitAndAwait

open-knowledge-base

Description: Open the Knowledge Base tab to a specified wiki page.

Nameopen-knowledge-base
Parameters
wikiId string
Function api.events.emit

autosort-plugins

Description: Run LOOT sort operation. Only has an effect if the active game is a gamebryo game.

Nameautosort-plugins
Parameters
manual boolean Whether the user actively invoked the sort
callback (err: Error) => void
Function api.events.emit

show-main-page

Description: Change the main navigation page

Nameshow-main-page
Parameters
pageId string
Function api.events.emit

quick-launch

Description: Start the primary executable (game or tool) for the active game

Namequick-launch
Parameters
Function api.events.emit

Internal Event List

If you monitor the event emitter in Vortex you may see the following events emitted or handled. We’re not documenting them because they are intended only for internal use. Please do not use them in extensions, if you actually have a use case for any of these, please contact us. Since we don’t consider these events part of the public API we may be changing them at any time without notice or mention in the changelog.