SKSE System Messages
When certain events happen, SKSE sends “messages” which your plugin can listen for:
Types of messages
Message | Description |
---|---|
kPostLoad |
Sent once all SKSE plugins have been loaded. |
kPostPostLoad |
Sent immediately after kPostLoad has been sent to all plugins. (Used to help coordinate cross-plugin messaging.) |
kInputLoaded |
Sent after the game’s input initializes, right before the Main Menu initializes |
kDataLoaded |
Sent after all of the game plugin files have been loaded (all Forms are loaded) |
kNewGame |
Sent after a new game has been created, but before the game has loaded |
kSaveGame |
Sent when saving a game |
kDeleteGame |
Sent right before deleting the .skse cosave and the .ess save |
kPreLoadGame |
Runs before the savegame is loaded by Skyrim |
kPostLoadGame |
Runs after the savegame has been loaded by Skyrim. |
Listening for messages
Registration of a plugin’s listener function is done via the SKSE Messaging Interface:
auto* messagingInterface = SKSE::GetMessagingInterface();
Use RegisterListener
to provide a callback which returns void
and accepts a pointer to the Message
being sent:
messagingInterface->RegisterListener(OnMessage);
// ...
void OnMessage(SKSE::MessagingInterface::Message* message) {
// This function can read the Message* being sent
}
Message*
An SKSE Message
has 4 fields:
Field | Description |
---|---|
->type |
An integer representing one of the enum values listed above ( kDataLoaded , kSaveGame , …) |
->sender |
The name of the plugin which sent this message (For system messages, this will always be "SKSE" ) |
->data |
A void* pointing at a data structure sent with this message, if any |
->dataLen |
If data is not a nullptr , this will be the sizeof the data structure |
Provided data
for different types of messages
Some SKSE messages are sent with data
:
Message | Description |
---|---|
kPostLoad |
(no data) |
kPostPostLoad |
(no data) |
kInputLoaded |
(no data) ? todo: verify ? |
kDataLoaded |
(no data) ? todo: verify ? |
kNewGame |
CharGen TESQuest* |
kSaveGame |
(???) ? todo: verify ? |
kDeleteGame |
char* file path of .ess savegame file |
kPreLoadGame |
char* file path of .ess savegame file |
kPostLoadGame |
bool, true if game successfully loaded, false otherwise |