Evolve Idle Cloud Save

Automatically upload your evolve save to a gist

当前为 2024-12-22 提交的版本,查看 最新版本

作者
Alistair1231
评分
0 0 0
版本
0.3.0
创建于
2024-03-20
更新于
2024-12-22
大小
11.0 KB
许可证
GPL-3.0
适用于

Evolve Idle Cloud Save

I lost my save game 😞. To prevent this from happening again, I implemented a quick backup, that uses GitHub Gist to store the save data.

What does it do?

It makes a backup every 30 minutes (adjustable at the bottom of the script). The save game will be written to a gist, that is defined by the user. By using a gist, you also get the benefit of versioning. So you can roll back to earlier saves. 😉

I recommend using a separate file for each PC, otherwise your savegame might get overwritten by another PC, which has the tab open in the background. Also, only have one tab open at a time, otherwise the save might get overwritten by the other tab. This is easily recoverable, using the revision history of the gist, but it is worth mentioning. 😅

How to use?

On first setup you will need to manually create a GitHub API key and a Gist and then input them for the script to use. This is only tested on Violentmonkey. Some other Userscript managers might handle the GM functions differently. If something does not work, try to use Violentmonkey. 😊

Setup instructions

You will need a GistID and a Personal Access Token with Gist scope to use this.

Create a gist, the description does not matter, in this Gist, create a file e.g. called "save.txt", add some random content and save. You can do that here (You will need a GitHub account): https://gist.github.com Afterwards, you can find the GistID in the URL: https://gist.github.com/{Username}/{GistID}

The Personal Access Token you have to create here: https://github.com/settings/tokens you only need the gist scope.

If you make a mistake you should be asked again, alternatively you can manually set these values in the Userscript storage. In Violentmonkey you can access this by clicking on the extension icon, then right-clicking on the script and selecting Values. There we want values like this (these are random examples I didn't leak my credentials 😉):

{
filename: "save.txt",
gistId: "856ce06ecda1234e095c156da8fd44d7",
token: "ghp_k928znRUu7ZI0tySv9gP2A2x9VdvVLrmrXCD"
}

I installed, what now?

Now, every 30 minutes your save game will be saved to the gist. You can also manually trigger a backup by clicking the "Save in Gist" button in the game UI. You can also import the save game from the gist by clicking the "Import Gist" button in the game UI. After "Import Gist", you still have to click the "Import Game" button for the save to be loaded. "Import Gist" only fills the textarea.

How does it work? (technical)

The script makes use of GM.xmlhttpRequest for the request and GM.setValue/GM.getValue for storing/retrieving the secrets. The timing is done with setInterval. For saving the Data the GitHub API is used. The save game is exported using the exportGame function, which is exposed by the game. The save game is then sent to the GitHub API using a PATCH request.

I hope I can prevent some people from loosing their save games, and allow for more easy switching between devices. 😊