Skip to content

Instantly share code, notes, and snippets.

@debnath
Last active August 16, 2026 13:29
Show Gist options
  • Select an option

  • Save debnath/6ed41a0f48dbfaa0f892f4b4f0e88432 to your computer and use it in GitHub Desktop.

Select an option

Save debnath/6ed41a0f48dbfaa0f892f4b4f0e88432 to your computer and use it in GitHub Desktop.
How to save and load the state of the paperclips game (www.decisionproblem.com/paperclips/index2.html)
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.
@emrehorsanali

Copy link
Copy Markdown

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')

@pww22

pww22 commented Nov 22, 2019

Copy link
Copy Markdown

Nice work Debnath, keep changing the world buddy

@BadZooka

BadZooka commented Aug 24, 2022

Copy link
Copy Markdown

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

@git42leech

Copy link
Copy Markdown

@BadZooka, you’ll have to edit the script as suggested. Works perfectly fine once it’s edited.

@Mobyrr

Mobyrr commented Nov 17, 2024

Copy link
Copy Markdown

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(';'))

@hkjadkjs

Copy link
Copy Markdown

it says that is undefined

@xmastime

Copy link
Copy Markdown

Paperclips Save/Load Bookmarklets

Two simple browser bookmarklets for backing up and restoring your Universal Paperclips game save using a local JSON file.

These bookmarklets work with the game's localStorage save data and are designed to avoid the loadPrestige is null error that can occur when savePrestige is missing.

💾 Save Game

Create a browser bookmark called Paperclips Save and put the following in its URL/address field:

javascript:(()=>{let k=["saveGame","savePrestige","saveProjectsActive","saveProjectsFlags","saveProjectsUses","saveStratsActive"],d={};k.forEach(x=>{let v=localStorage.getItem(x);if(v!==null)d[x]=v});let b=new Blob([JSON.stringify(d)],{type:"application/json"}),a=document.createElement("a");a.href=URL.createObjectURL(b);a.download="paperclips-save.json";a.click();setTimeout(()=>URL.revokeObjectURL(a.href),1000)})()

When clicked while on the Paperclips game page, it downloads:

paperclips-save.json

If savePrestige doesn't exist, it is not written to the backup file. This is important because storing a literal "null" value can cause the game to fail when loading.

📂 Load Game

Create another bookmark called Paperclips Load and put this in its URL/address field:

javascript:(()=>{let i=document.createElement("input");i.type="file";i.accept=".json,application/json";i.onchange=()=>{let r=new FileReader;r.onload=()=>{try{let d=JSON.parse(r.result),k=["saveGame","savePrestige","saveProjectsActive","saveProjectsFlags","saveProjectsUses","saveStratsActive"];k.forEach(x=>localStorage.removeItem(x));Object.entries(d).forEach(([k,v])=>{if(v!==null)localStorage.setItem(k,v)});alert("Paperclips save loaded! Reload the page to apply it.")}catch(e){alert("Invalid save file: "+e)}};r.readAsText(i.files[0])};i.click()})()

Click the bookmark, select your paperclips-save.json file, and then reload the game.

Important

  • Use the bookmarks while on the Universal Paperclips game website.
  • Keep backup copies of your JSON files somewhere safe.
  • Loading a save replaces the relevant localStorage values currently stored by the game.
  • The loader handles a missing or null savePrestige correctly by leaving the key removed.
  • This is a local backup tool; the save file is not uploaded anywhere.

Installation

  • Open Universal Paperclips.
  • Create a new browser bookmark.
  • Name it Paperclips Save.
  • Paste the Save bookmarklet into the bookmark's URL field.
  • Create another bookmark named Paperclips Load.
  • Paste the Load bookmarklet into its URL field.
  • Save and test the Save bookmark first.

Tip: Some browsers hide the bookmark URL field when creating bookmarks from the current page. Edit the bookmark afterward and replace its URL with the javascript: code above.

License / Disclaimer

This is an unofficial convenience tool for backing up and restoring browser localStorage data used by Universal Paperclips.

Use it at your own risk and keep independent backups of important saves.


✨ Created with ChatGPT

Bookmarklets and documentation created with assistance from ChatGPT (GPT-5.6 Luna).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment