on_save event or similar mechanism ?

Place to get help with not working mods / modding interface.
User avatar
SeigneurAo
Long Handed Inserter
Long Handed Inserter
Posts: 57
Joined: Tue Oct 18, 2016 11:13 am
Contact:

on_save event or similar mechanism ?

Post by SeigneurAo »

Hello.

I'd like to add a save file backup functionality, so that every time a save or autosave is written, it is immediately replicated on another location, but it doesn't seem like there's any API event triggered when this happens.
Is there any plan to add such an event ?

Or does anyone have an idea how I might work around this, in order to achieve wanted behaviour ?
At first I thought I'd use one of the many ways one can monitor file changes on *nix systems, and fire the backup based on that, but all things considered I'd prefer something which doesn't rely on a given OS or file system for compatibiliy's sake, that's why I looked into the official API.
Regular sync on saves folder is another option, but I'd definitely prefer something that's tied to the game rather than the OS or filesystem, for the same reasons as stated above.

Thanks in advance !
SyncViews
Filter Inserter
Filter Inserter
Posts: 295
Joined: Thu Apr 21, 2016 3:17 pm
Contact:

Re: on_save event or similar mechanism ?

Post by SyncViews »

Going with an external program is the way to go. Even if there was an on_save event, you don't have full disk access, no network access, and on a server it would try and operate with identical settings on every client machine and probably crash. The only kinda exception is the `game.server_save(name)` function which provides no feedback and has limited options as to where/how it saves.


Doing something as simple as making the save directory be a dropbox or other synronised location should work. Otherwise it is a fairly simple program to write, plenty of libraries around.
User avatar
SeigneurAo
Long Handed Inserter
Long Handed Inserter
Posts: 57
Joined: Tue Oct 18, 2016 11:13 am
Contact:

Re: on_save event or similar mechanism ?

Post by SeigneurAo »

Thanks to you both for your valuable input. Guess I'll settle for an external approach then.
Post Reply

Return to “Modding help”