-
-
Save debnath/6ed41a0f48dbfaa0f892f4b4f0e88432 to your computer and use it in GitHub Desktop.
The paperclips game over at www.decisionproblem.com/paperclips/index2.html is great, but if you want to play the game indefinitely you can lose all progress if you clear browser cache or change laptop. | |
I wanted a way to create a save file and load it later, so I did. Use the below script to generate the output to load the current game state. | |
var saveGame=localStorage.getItem("saveGame"),savePrestige=localStorage.getItem("savePrestige"),saveProjectsActive=localStorage.getItem("saveProjectsActive"),saveProjectsFlags=localStorage.getItem("saveProjectsFlags"),saveProjectsUses=localStorage.getItem("saveProjectsUses"),saveStratsActive=localStorage.getItem("saveStratsActive"),restoreString="/************* COPY ALL TEXT BELOW THIS LINE AND SAVE IN A TEXTFILE SOMEWHERE. RUN IT IN ANY CHROME OR FIREFOX CONSOLE TO LOAD IT. *************/\nlocalStorage.setItem('saveGame', '"+saveGame+"') \nlocalStorage.setItem('savePrestige', '"+savePrestige+"') \nlocalStorage.setItem('saveProjectsActive', '"+saveProjectsActive+"') \nlocalStorage.setItem('saveProjectsFlags', '"+saveProjectsFlags+"') \nlocalStorage.setItem('saveProjectsUses', '"+saveProjectsUses+"') \nlocalStorage.setItem('saveStratsActive', '"+saveStratsActive+"') \n";console.log(restoreString); | |
1) If you don't know how to run it, first, copy the above script into your clipboard (highlight the entire line above and press command c). | |
2) Then, in Chrome, go to the paperclip game webpage -> right-click on your mouse -> click 'inspect' -> click 'console' -> rightclick and press 'paste' -> press enter. | |
3) You'll see a bunch of grey text appear under "COPY ALL TEXT BELOW THIS LINE AND SAVE IN A TEXTFILE SOMEWHERE". Save that text to a textfile or email somewhere. This will be your savegame file. | |
4) Whenever you want to load that savefile, just go back into the console (mentioned in step2) and paste the contents that you saved in step 3. | |
5) You will need to repeat steps 1-4 every time you want to save the game. |
Nice work Debnath, keep changing the world buddy
Is this still working? I used the command line to get my save state, saved it in a *.txt-file, but now whenever I enter the copied contents into the console while on the site my Chrome console just returns 'undefined'.
EDIT: I just noticed that, after pasting the contents of my file, I cannot access the game at all when reloading the page. The error message:
Uncaught TypeError: loadPrestige is null loadPrestige https://www.decisionproblem.com/paperclips/main.js?v3:6497 <anonymous> https://www.decisionproblem.com/paperclips/main.js?v3:4181
@BadZooka, you’ll have to edit the script as suggested. Works perfectly fine once it’s edited.
the same result but more compact, without bug and copy the save directly to the clipboard :
save();copy(Object.entries(localStorage).map(([k,v])=>`localStorage.setItem('${k}','${v}')`).join(';'))
If this error occurs:
TypeError: null is not an object
Try changing this line in what you copied (or the one with 'null'):
localStorage.setItem('savePrestige', 'null')
To this:
localStorage.removeItem('savePrestige')