Resetting the game

From Universal Paperclips Wiki
Jump to: navigation, search

There are a limited number of ways to reset the game.

Projects
Cheats
  • Enabling cheats will show a button which to reset the game (same as reset() function below)
Browser console
  • Open the browser console (generally F12) and enter reset()
  • Use the browser console to halt the game loops and then clear localStorage (see below). This also allows to edit the game state.
Incognito
  • If you open the game in an incognito window on Chrome/Firefox, the local storage will be erased when you close the tab/window, resetting the game at the next load.

Browser Console[edit | edit source]

See cheats page for details on how to open the browser console.

Stop the loops[edit | edit source]

The game data is saved in a variable called localStorage, which has a function clear() that empties its contents. However, the game loop will restore the values almost immediately, so you must halt the loop first.

The loop is running with several setInterval calls, which can be halted with clearInterval. clearInterval requires an interval id, but unfortunately the game doesn't store that value anywhere. Fortunately, most browsers simply assign consecutive integer values for ids, so you can clear all intervals by creating a new interval and hitting its id well 999

let id = window.setInterval(() => {});
for (let i = 0; i <= id; i++) window.clearInterval(i);
localStorage.clear();

The loop should also stop when the game is stopped, specially at the end of the game on the Reject option.

Editing the game[edit | edit source]

After you've stopped the game, you can edit the game state.

  • On Firefox: While on the game tab, use Tools -> Web Developer -> Web Console -> Storage -> Local Storage. Right click, and then "delete all"

You can also save game states by locally saving (in a text file on your computer) the saveGame, saveProjectsActive, saveProjectsFlags, saveProjectsUses, and saveStratsActive variables. You can then edit them at will. The game will resume with them after loading, which will happen if you close the tab and open it again.

You can also do this without stopping the game loop by locally altering the savefile (the "savegame" variable), then pasting your text into the variable, and closing the tab quickly before it's overwritten by the current state of the game. Then, on opening the tab, the altered game state will be loaded.