ArgieAnon

How to save locally and disable Google Cloud saving

Dec 11th, 2019
669
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. This will fix the local saving and loading, based off the torrent local version.
  2.  
  3. Create a folder called "stories" in the AIDungeon root. (If you don't want to do this, remove stories\ from the path in the two functions below, but it clutters your root folder)
  4.  
  5. Go into story\story_manager.py and replace the following two functions with this code:
  6.  
  7. def save_to_storage(self):
  8. self.uuid = str(uuid.uuid1())
  9.  
  10.  
  11. story_json = self.to_json()
  12. file_name = "stories\story" + str(self.uuid) + ".json"
  13. f = open(file_name, "w")
  14. f.write(story_json)
  15. f.close()
  16.  
  17. return self.uuid
  18.  
  19.  
  20. def load_from_storage(self, story_id):
  21.  
  22. file_name = "stories\story" + story_id + ".json"
  23. with open(file_name, 'r') as fp:
  24. game = json.load(fp)
  25. self.init_from_dict(game)
  26. return str(self)
  27.  
  28. That's it. Local saving and no upload to the Cloud bullshit.
  29. For the visually retarded, your file should look like this: https://i.ibb.co/C93pDJp/Should-look-like-this-save.png
Add Comment
Please, Sign In to add comment