Transferring saves from desktop to web version

Klimber

Warper
Member
Joined
Apr 2, 2020
Messages
4
Reaction score
0
First Language
Ukrainian
Primarily Uses
RMMV
Hello, please tell me what you need to do to integrate external save into the web version of the project?
 

Hyouryuu-Na

Procrastinator
Veteran
Joined
Jun 15, 2017
Messages
769
Reaction score
1,731
First Language
Not English
Primarily Uses
RMMV
It would've been better if you gave a little more info about your problem but I'm guess you want to use desktop saves for web games?
I'm not sure I'm informed enough to respond but in case nobody does... here's what I think-
Web version save files are saved in the local storage. You can't physically take the save files and drop them somewhere but there's this part in rpg_managers:
StorageManager.saveToWebStorage = function(savefileId, json) {
var key = this.webStorageKey(savefileId);
var data = LZString.compressToBase64(json);
localStorage.setItem(key, data);
};

If you can extract the contents of your desktop save file, then you can pretty much use this function here to transfer the save to the web version.
 

Kupotepo

Fantasy realist/ Forum Reactor‍
Veteran
Joined
Jul 5, 2017
Messages
1,782
Reaction score
1,793
First Language
Thai
Primarily Uses
RMMV
@Hyouryuu-Na, I need help lol is that descriptive hahaha.

Anyhow, please give us more details. Sometimes, it is complicated.
 
Last edited:

Klimber

Warper
Member
Joined
Apr 2, 2020
Messages
4
Reaction score
0
First Language
Ukrainian
Primarily Uses
RMMV
Let me explain the case itself.

My comrades are testing the game through a browser, it is more convenient for them, since everyone has different os and it is not always possible to download individual versions.

In order to make it easier to test different quests, I prepare a save file before each quest. But my comrades don't see them in the browser. Is there any way to export save files from the desktop version to the browser version? Even if for this they will have to run some script in the browser console.
 

Hyouryuu-Na

Procrastinator
Veteran
Joined
Jun 15, 2017
Messages
769
Reaction score
1,731
First Language
Not English
Primarily Uses
RMMV
@Klimber I figured you wouldn't need anything too complex so here you go:
Put this as a script anywhere in your game:

JavaScript:
var ID = prompt("Save file ID to save to: ")
var saveContents = prompt("Save file contents: ")
var key = this.webStorageKey(ID);
localStorage.setItem(key, saveContents);
var globalContents = prompt("Global file contents: ")
StorageManager.save(0, globalContents);

What you have to do is- give them the save files. Share them anyhow you like. Your players have to open it with a text editting program (Or you can just paste the save contents yourself if you're communicating in a chatroom or anything like that). Then they have to copy the entire thing. Then they will run this script ( through an event) It'll ask them which save slot to save this content in. They can just paste the contents into the box. When they click yes, the file will be saved to their web storage. Then, they have to hit F5 to refresh the game. Next times they open the game, they will see the new Save File in the Load menu. Make sure to give them the global.rpgsave too.
 
Last edited:

Klimber

Warper
Member
Joined
Apr 2, 2020
Messages
4
Reaction score
0
First Language
Ukrainian
Primarily Uses
RMMV
@Hyouryuu-Na I ran the script both separately in the console and in the web project, but the game constantly throws the same error, regardless of what was entered in the pop-up line: 1597570150284.png
Can you give me an example of what to write in pop-up messages?
 
Last edited:

Ossra

Formerly Exhydra
Veteran
Joined
Aug 21, 2013
Messages
1,076
Reaction score
845
First Language
English
Primarily Uses
RMMV
EDIT : Bargle. Too sleep deprived. I went the wrong direction with the saves.
 
Last edited:

Hyouryuu-Na

Procrastinator
Veteran
Joined
Jun 15, 2017
Messages
769
Reaction score
1,731
First Language
Not English
Primarily Uses
RMMV
@Klimber
I made a stupid mistake. Now it should work:
JavaScript:
var ID = prompt("Save file ID to save to: ")
var saveContents = prompt("Save file contents: ")
if (saveContents!=null){
StorageManager.saveToWebStorage1 = function(ID, saveContents){
var key = this.webStorageKey(ID)
localStorage.setItem(key, saveContents);
}
StorageManager.saveToWebStorage1(ID, saveContents);
}
else{alert("Save Contents is null. Data won't be saved.");}
Instructions are same as before.
NOTE!!! Global was not overwriting for some reason... It's saved and you can still read it with localStorage.getItem but it's not working for the game itself... so your players will need to make a save first and then use this script to overwrite that save (same save slot) i.e they can't save to a completely new save slot. That save slot must have prior saves.

Those popup windows could be of three types afaik. Alert, prompt and confirm. If you want to get input from the player, you can use prompt. If you just want to give them a message, you can use alert. And confirm is for ok cancel sorta stuff. I don't really like these as they're a seperate window outside the game. So they sorta break immersion.
Anyways, for prompt, it's like,
JavaScript:
var x = prompt("message");
The message you want to give the player is shown and their input is stored to a variable (here, it's x). The variable can be a game variable too.
 
Last edited:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Recent threads, and my very poor algorithm for my minimap plugin have made me face the fact that I need to review algorithms and such.

Going through Cracking the Coding Interview now. I am so excited.
Kes
I've seen a reference to a Community Lighting plugin for MZ, but cannot find it. Is it still in beta?

Todo:
Add fog of war
Add enemy indicators
Make window draggable
Optimise map drawing algorithm (5 seconds to load the map you see, so it's a... poo-poo algorithm)

Any suggestions? :kaoblush:
bleh studio hell job haha at least they like it didnt had time to do much laundry tho ;w;'....YES I DO AT LEAST TAKE A SHOWER everyday!
Ami
--- Food Ingredients ---

Hero: Since the Chef are in Hospital,we can't eat his Dish in 3 Days.
F.Mage: What we have to Eat?
M.Healer: Don't worry,we can Eat the Food Ingredients.
Hero & F.Mage
: Really?

(3 Days Later)

Chef: Hi,Guys. I'm Ba---
(Entire Party Collapse After Eat Raw Meat)
Chef: Wha...WHAT GOING ON HERE!!!!!!

Forum statistics

Threads
102,913
Messages
995,920
Members
134,363
Latest member
Wilsonliz
Top