Advertisement
zyzzyzus

Import/export saves in IGM games.

May 11th, 2014
36,613
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. Adds import/export buttons and a text box to the save box in IGM games.
  3. Clicking the export button will display the save code in the text box.
  4. Save the code to a text file or upload and then if you need to use the backup load this mod first then use the import button.
  5. The functions created by the mod are modified versions of the save/load functions used by IGM.
  6. */
  7.  
  8. eval('Export=' + Game.Save.toString().replace('localStorage[Game.src]=str;','l(\'savecode\').value=str'));
  9. eval('Import=' + Game.Load.toString().replace('function ()','function (str)').replace('var str=localStorage[Game.src];',''));
  10. if(!modloaded){
  11. l('saveBox').innerHTML +="<div class='button' onclick='Export();'>Export Save</div><div class='button' onclick='Imports();'>Import Save</div><textarea id='savecode' style = 'resize: none'></textarea>";
  12. var modloaded = true;
  13. }
  14. Imports=function(){
  15. var savecode = prompt("Enter Save Code:","");
  16. if(savecode && savecode.length > 20){
  17. Import(savecode);
  18. }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement