您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Automatically upload your evolve save to a gist
当前为
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.
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. 😅
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. 😊
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"
}
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.
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. 😊