Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » HELP PLEASE
- gokujrules
- Scratcher
26 posts
HELP PLEASE
As some of you may know. I am working on a huge MMORPG, everything else is flawless, I even made a charecter creation. But the only thing is. There will be levels and Points and everything but I really don't know how to make save data…
- E1eventeen
- Scratcher
70 posts
HELP PLEASE
The best way to do a save file is to combine all the needed variables into one line of text which would be copied and pasted into and out of the game
- slombeeper123
- Scratcher
8 posts
HELP PLEASE
I don't think you can save data automatically while playing the game. You'll have to use the username function to save you progress manually in the script. You can also use Data to save progress during the game, but that progress dissapears when you quit the game.
when green flag clicked
if <(username) = [your username]> then
end
- slombeeper123
- Scratcher
8 posts
HELP PLEASE
The best way to do a save file is to combine all the needed variables into one line of text which would be copied and pasted into and out of the game
Oh yes, that works too!
- jokebookservice1
- Scratcher
1000+ posts
HELP PLEASE
So, you can either do what E1eventeen said to do, which is to combine all variables like this:
Cat - Hell\o
Dog - B;an;aana
Egg - Dollar$
Now, you can separate them with semicolons, BUT you must replace existing semicolons with \; and replace existing \s with \\s.
Cat;Hell\\o;Dog;B\;a\;naana;Egg;Dollar;
How to decode:
Loop through each character
If it is a backslash, treat the next letter as a character, without any special meaning
If it is a semicolon (and the previous step said it shouldn't be ignored) then that means the item has ended.
But maybe you want a more secure save code. You could store the user's username in the save code, like so
Cjaotk;eHbeololk\s\eor;vDiocge;1B \ ; a n a a n a ; E g g ; D o l l a r ;
You just need to skip every other character when doing the detection, and also compare the username. If the user is logged out, you can give them a save code that should work whether you are logged in or not.
Finally, you might want to obfuscate the code, so that users cannot easily understand how it works. First, create a list of characters that might come up. Now, shift each character you encounter by 3 places, and remember to wrap around when you get to the end of the list. This is called a Ceaser Cipher, a.k.a a shift cipher. A becomes D, B becomes E, …, Y becomes B, Z becomes C. The backslash and semicolon can stay the same if you want. This will only work if you don't mind upper and lower case letters being all converted to one of the two.
Fmdrwn;hKehroron\v\hru;yGlrfjh;1E \ ; d q d d q d ; H j j ; G r o o d u ;
Oh, and after the first space, you might want the project to realise the username has ended, so that you don't have to put any more spaces after it. Hope this helps
Cat - Hell\o
Dog - B;an;aana
Egg - Dollar$
Now, you can separate them with semicolons, BUT you must replace existing semicolons with \; and replace existing \s with \\s.
Cat;Hell\\o;Dog;B\;a\;naana;Egg;Dollar;
How to decode:
Loop through each character
If it is a backslash, treat the next letter as a character, without any special meaning
If it is a semicolon (and the previous step said it shouldn't be ignored) then that means the item has ended.
But maybe you want a more secure save code. You could store the user's username in the save code, like so
Cjaotk;eHbeololk\s\eor;vDiocge;1B \ ; a n a a n a ; E g g ; D o l l a r ;
You just need to skip every other character when doing the detection, and also compare the username. If the user is logged out, you can give them a save code that should work whether you are logged in or not.
Finally, you might want to obfuscate the code, so that users cannot easily understand how it works. First, create a list of characters that might come up. Now, shift each character you encounter by 3 places, and remember to wrap around when you get to the end of the list. This is called a Ceaser Cipher, a.k.a a shift cipher. A becomes D, B becomes E, …, Y becomes B, Z becomes C. The backslash and semicolon can stay the same if you want. This will only work if you don't mind upper and lower case letters being all converted to one of the two.
Fmdrwn;hKehroron\v\hru;yGlrfjh;1E \ ; d q d d q d ; H j j ; G r o o d u ;
Oh, and after the first space, you might want the project to realise the username has ended, so that you don't have to put any more spaces after it. Hope this helps
- gokujrules
- Scratcher
26 posts
HELP PLEASE
So basically, lets say my health points are 7, and my power points are 2, I just combine them to make 72? I get what your talking about, but the player will continously have to write down new codes; Plus, if the player is smart enough to hack the game by making their own code like 99, they can instantly beat the game.
- E1eventeen
- Scratcher
70 posts
HELP PLEASE
Plus, if the player is smart enough to hack the game by making their own code like 99, they can instantly beat the game.
You can use an encoder and decoder which makes it harder to nerf the numbers, but there is otherwise no way around it
- gokujrules
- Scratcher
26 posts
HELP PLEASE
And what is that internet thing? That seems completely off topic…
- jokebookservice1
- Scratcher
1000+ posts
HELP PLEASE
Not quite. What if you had 16 health point and 3 power points. If the code was 163, does that mean 16 and 3, or 1 and 63? Thus you will have to make all things a fixed length. In my example, the code should've been 1603 or 0163 depending on whether it was 16 and 3 or 1 and 63 respectively. So basically, lets say my health points are 7, and my power points are 2, I just combine them to make 72? I get what your talking about, but the player will continously have to write down new codes; Plus, if the player is smart enough to hack the game by making their own code like 99, they can instantly beat the game.
To stop them from hacking it, read my post, shift the characters, maybe reverse them, and you might also want to mix in their username (so that you cannot share codes).
Using Cloud Data, you can store numbers on the internet, so that the user never sees the save code. Assuming you are encoding numbers like 0163 then to seperate different people's codes, you can use 00s. However, you *have* to store the person's username with the code, and you have to convert the username into a number so that you can put it into cloud data. A save code like 0163 which is 0, 1, 6, and 3, would have to be shifted by 27 so that it becomes 27283330 and then you can attach letters after a 00 by doing A is 01, B is 02 and so on. And what is that internet thing? That seems completely off topic…
- gokujrules
- Scratcher
26 posts
HELP PLEASE
There is only 1 MMORPG on scratch that I know of: Otimus MMORPG by itsmomito, but in the game, he saves data with a username, so how is the data linked with your scratch account?
- Extremguy
- Scratcher
100+ posts
HELP PLEASE
You have to think of it a big list.
The cloud variable is a big encoded list in decimal (maybe hexa , but I dont know ABCDEF dont work for some reason , so I say decimal)
You just have to decode that variable and then chop these information at their spot by making your own method of decoding.
And then you have to rencode it with the value you have changed and then you can set the global variable to your big rencoded value.
Here's an example
https://scratch.mit.edu/projects/127135844/
The cloud variable is a big encoded list in decimal (maybe hexa , but I dont know ABCDEF dont work for some reason , so I say decimal)
You just have to decode that variable and then chop these information at their spot by making your own method of decoding.
And then you have to rencode it with the value you have changed and then you can set the global variable to your big rencoded value.
Here's an example
https://scratch.mit.edu/projects/127135844/
Extremguy le ptit tannant qui fait des gros petit projets avec Scratch depuis 2012.
Envie de créer tes propres jeux 2d a monde ouvert plus facilement. Viens utiliser dès maintenant mon projet!
- jokebookservice1
- Scratcher
1000+ posts
HELP PLEASE
To put Hexadecimal into a cloud variable, it must begin with 0x. For example
0x12aC4F
- Discussion Forums
- » Help with Scripts
- » HELP PLEASE