def save_game(send_save_message: bool = False,
              check_cooldown: bool = True,
              _connection=None):
    save_game_data = SaveGameData(0, 'scratch', True, None)
    persistence_service = services.get_persistence_service()
    persistence_service.save_using(persistence_service.save_game_gen,
                                   save_game_data,
                                   send_save_message=send_save_message,
                                   check_cooldown=check_cooldown)
def save_to_new_slot(slot_id: int = 0,
                     slot_name='Unnamed',
                     auto_save_slot_id: int = None,
                     ignore_callback=False,
                     _connection=None):
    save_game_data = SaveGameData(slot_id, slot_name, False, auto_save_slot_id)
    persistence_service = services.get_persistence_service()
    persistence_service.save_using(persistence_service.save_game_gen,
                                   save_game_data,
                                   send_save_message=True,
                                   check_cooldown=False,
                                   ignore_callback=ignore_callback)
def save_game_with_autosave(slot_id: int = 0,
                            slot_name='Unnamed',
                            is_new_slot: bool = False,
                            auto_save_slot_id: int = None,
                            _connection=None):
    override_slot = not is_new_slot
    save_game_data = SaveGameData(slot_id, slot_name, override_slot,
                                  auto_save_slot_id)
    persistence_service = services.get_persistence_service()
    persistence_service.save_using(persistence_service.save_game_gen,
                                   save_game_data,
                                   send_save_message=True,
                                   check_cooldown=False)
 def _time_to_save(*_) -> bool:
     try:
         if CommonZoneSpinEventDispatcher().game_loading or not CommonZoneSpinEventDispatcher().game_loaded:
             return False
         CommonBasicNotification(
             'S4ASM Autosaving',
             0
         ).show()
         import sims4.commands
         save_game_data = SaveGameData(CommonSaveUtils.get_save_slot_id(), 'S4ASMAutosave', True, 500001)
         persistence_service = services.get_persistence_service()
         persistence_service.save_using(persistence_service.save_game_gen, save_game_data, send_save_message=True, check_cooldown=False)
         CommonBasicNotification(
             'S4ASM Finished Autosaving',
             0
         ).show()
         return True
     except Exception as ex:
         CommonBasicNotification(
             'Problem Occurred While S4ASM Autosaving',
             0
         ).show()
         CommonExceptionHandler.log_exception(ModInfo.get_identity(), 'An exception occurred while autosaving.', exception=ex)
         return False