Save Event Types

Save Loaded Event

class S4CLSaveLoadedEvent(save_slot_data)

Bases: sims4communitylib.events.event_handling.common_event.CommonEvent

An event that occurs upon a Save being loaded (After it has been loaded).

Example usage:
from sims4communitylib.events.event_handling.common_event_registry import CommonEventRegistry
from sims4communitylib.modinfo import ModInfo

class ExampleEventListener:

    # In order to listen to an event, your function must match these criteria:
    # - The function is static (staticmethod).
    # - The first and only required argument has the name "event_data".
    # - The first and only required argument has the Type Hint for the event you are listening for.
    # - The argument passed to "handle_events" is the name of your Mod.
    @staticmethod
    @CommonEventRegistry.handle_events(ModInfo.get_identity().name)
    def handle_event(event_data: S4CLSaveLoadedEvent):
        pass

Save Saved Event

class S4CLSaveSavedEvent(save_slot_data)

Bases: sims4communitylib.events.event_handling.common_event.CommonEvent

An event that occurs upon a Save being saved (Before it has been saved).

Note

This event will only occur when the Player manually saves the game.

Example usage:
from sims4communitylib.events.event_handling.common_event_registry import CommonEventRegistry
from sims4communitylib.modinfo import ModInfo

class ExampleEventListener:

    # In order to listen to an event, your function must match these criteria:
    # - The function is static (staticmethod).
    # - The first and only required argument has the name "event_data".
    # - The first and only required argument has the Type Hint for the event you are listening for.
    # - The argument passed to "handle_events" is the name of your Mod.
    @staticmethod
    @CommonEventRegistry.handle_events(ModInfo.get_identity().name)
    def handle_event(event_data: S4CLSaveSavedEvent):
        pass
Parameters:save_game_data (SaveGameData) – The data that will be saved.
save_game_data

The game data that will be saved.

save_slot_id

The id of the save slot.

save_slot_name

The name of the save slot.