Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Cloud Variable Saving
- DABICCO
-
Scratcher
13 posts
Cloud Variable Saving
Hi I’m making a game and I am asking if I can make a cloud variable only store the data for one user, like an auto-save feature.
I’m confused on how cloud variables work as I have not really ever used them before.
Any answers appreciated!
Thanks!
I’m confused on how cloud variables work as I have not really ever used them before.
Any answers appreciated!
Thanks!
- a1dang
-
Scratcher
100+ posts
Cloud Variable Saving
If you have a list with the alphabet in it, starting at 10 (1-9 should be blank), you can write a script to convert a username to 2 digit numbers using it. Then have a cloud variable that starts with that username made from numbers, followed by the save data. Then have a script on project start that converts the users username to numbers, then checks if the cloud variable begins with that, and if so, load in the save data at the end of it.
Sorry for not giving any actual code here, just supplying a basic view of what you would have to do.
Sorry for not giving any actual code here, just supplying a basic view of what you would have to do.
- DABICCO
-
Scratcher
13 posts
Cloud Variable Saving
Wait I meant to like be able to have a way for everyone who opens the game to always load it with their save data.
Maybe I got it wrong..?
Maybe I got it wrong..?
- legendary34678
-
Scratcher
1000+ posts
Cloud Variable Saving
No, they got it right. If you didn't understand what they said, could you tell us which part you didn't understand?
- deck26
-
Scratcher
1000+ posts
Cloud Variable Saving
All users see the same cloud data so if you have, for example, a high score variable all users will see the same value. To avoid that you need to store both the username and the value for that user. But since cloud variable only hold numeric digits you need to encode the username. See the wiki pages on Encoding & Decoding and Global High Scores to see how to do these things.
- Discussion Forums
- » Help with Scripts
-
» Cloud Variable Saving