Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Saving progress in a game to individual users?
- Elephants4Ever
-
6 posts
Saving progress in a game to individual users?
Hi! I'd like some help with saving progress in one of my games-in-progress to individual users. Can this be done? I don't want them to have to restart every time they play. I tried making it to where when they click save, it adds their username to a list. Also, when you open the game, it checks to see if their username is on the list. Where do I go from here? Is there a way to save a certain variable setting in relation to their username? Thanks for any help!
- andre_rifaut_tests
-
90 posts
Saving progress in a game to individual users?
There are three different possibilities: the easiest one, the easy and the difficult one.
1) each player can remix you project, then see inside, then play with it, then press save. You will have to modify a little bit your program so that “grenn flag” do NOT initialize (nearly) anything.
2) you DESIGN your game with levels. Each player can restart at some level. You can give a code to each player and it will have to give that code to begin at some level.
3) you willl use ONE could variable. But before using the cloud variable, you can “simulate” it with a list.
Step “saving games”
a) You register in the list a user, then a number of variables each one in a next cell of the list.
b) You do that for each player.
c) Then you have to translate everything into digits because cloud variable accepts only digits.
d) Then you pack that in the cloud variable.
Step “restauring games”
a) you slice your cloud variable to put back each item in the list
b) you map the digits into th original format
c) you select the list cells of the user that wants to play
d) you store the value found in the cells into the variables of the game.
1) each player can remix you project, then see inside, then play with it, then press save. You will have to modify a little bit your program so that “grenn flag” do NOT initialize (nearly) anything.
2) you DESIGN your game with levels. Each player can restart at some level. You can give a code to each player and it will have to give that code to begin at some level.
3) you willl use ONE could variable. But before using the cloud variable, you can “simulate” it with a list.
Step “saving games”
a) You register in the list a user, then a number of variables each one in a next cell of the list.
b) You do that for each player.
c) Then you have to translate everything into digits because cloud variable accepts only digits.
d) Then you pack that in the cloud variable.
Step “restauring games”
a) you slice your cloud variable to put back each item in the list
b) you map the digits into th original format
c) you select the list cells of the user that wants to play
d) you store the value found in the cells into the variables of the game.
- Xyyzzz
-
79 posts
Saving progress in a game to individual users?
Well to make this simple, we'll say that only one player is playing the game right now.
You can't simply add their name to a list, because lists don't save themselves to the Scratch website when you restart the game. However, cloud variables do. The tricky part is that you can only have numbers in cloud variables, but that's fine.
Considering this is a complex game, you should try recognizing each letter of the cloud variable as a different component. For example..
Cloud variable ‘Save1’ = 587
Whereas the 5 means the level the player was on, the 8 means the lives the player had, and the 7 meaning how many special attacks he has left (just examples).
Now to modify this cloud variable, you'll have to make a list dedicated to it so you can easily hop from the list and convert it into a cloud value. The list should contain each digit of the cloud variable. 5, 8, and 7. When the player advances a level,you can replace item 1 of the list to the current item plus 1. If there are more than 9 levels, you'll have to make the first value (level) a two-digit. Thus, the 5 would have to be a 05 to make room for a number above 09.
From there on, you can simply load the list as digits from the cloud variable and then recognize the name of the saved player, causing the level, lives and special attacks to start from what the list loaded as.
You can't simply add their name to a list, because lists don't save themselves to the Scratch website when you restart the game. However, cloud variables do. The tricky part is that you can only have numbers in cloud variables, but that's fine.
Considering this is a complex game, you should try recognizing each letter of the cloud variable as a different component. For example..
Cloud variable ‘Save1’ = 587
Whereas the 5 means the level the player was on, the 8 means the lives the player had, and the 7 meaning how many special attacks he has left (just examples).
Now to modify this cloud variable, you'll have to make a list dedicated to it so you can easily hop from the list and convert it into a cloud value. The list should contain each digit of the cloud variable. 5, 8, and 7. When the player advances a level,you can replace item 1 of the list to the current item plus 1. If there are more than 9 levels, you'll have to make the first value (level) a two-digit. Thus, the 5 would have to be a 05 to make room for a number above 09.
From there on, you can simply load the list as digits from the cloud variable and then recognize the name of the saved player, causing the level, lives and special attacks to start from what the list loaded as.
- jamiewinter
-
100+ posts
Saving progress in a game to individual users?
if you check out my project save point test you'll get a basic understanding of how it works, sadly its not gonna work tip cloud lists come out
- yugi1024
-
30 posts
Saving progress in a game to individual users?
Thanks this helped Well to make this simple, we'll say that only one player is playing the game right now.
You can't simply add their name to a list, because lists don't save themselves to the Scratch website when you restart the game. However, cloud variables do. The tricky part is that you can only have numbers in cloud variables, but that's fine.
Considering this is a complex game, you should try recognizing each letter of the cloud variable as a different component. For example..
Cloud variable ‘Save1’ = 587
Whereas the 5 means the level the player was on, the 8 means the lives the player had, and the 7 meaning how many special attacks he has left (just examples).
Now to modify this cloud variable, you'll have to make a list dedicated to it so you can easily hop from the list and convert it into a cloud value. The list should contain each digit of the cloud variable. 5, 8, and 7. When the player advances a level,you can replace item 1 of the list to the current item plus 1. If there are more than 9 levels, you'll have to make the first value (level) a two-digit. Thus, the 5 would have to be a 05 to make room for a number above 09.
From there on, you can simply load the list as digits from the cloud variable and then recognize the name of the saved player, causing the level, lives and special attacks to start from what the list loaded as.
- Scratcher1002
-
1000+ posts
Saving progress in a game to individual users?
There is a simple script to save, but I can't get it to overwrite data..
when this sprite clicked
add (join (join (join (join (join (username) [ - ]) (Part 1)) (Part 2)) (Part 3)) (Part 4)) to [Save data v]
- fastchimp47
-
34 posts
Saving progress in a game to individual users?
here how u do it
thats how u load it
when green flag clicked
ask [whats the tiltle] and wait
forever
if <(answer) = ( :: list) > then
set [() v] to [ ()]
end
end
- fastchimp47
-
34 posts
Saving progress in a game to individual users?
here how u do it
thats how u load it
when green flag clicked
ask [whats the tiltle] and wait
forever
if <(answer) = (title) > then
set [(score) v] to [ (score)]
end
end
- Lego-Lovin-Program
-
1000+ posts
Saving progress in a game to individual users?
There is a simple script to save, but I can't get it to overwrite data..when this sprite clicked
add (join (join (join (join (join (username) [ - ]) (Part 1)) (Part 2)) (Part 3)) (Part 4)) to [Save data v]
sadly, the lists reset when you refresh the page, so that wouldn't work.
- csf27278
-
8 posts
Saving progress in a game to individual users?
Yah It won't save, But if your working with numbers, part 1 part 2 so on and so forth could be cloud variables There is a simple script to save, but I can't get it to overwrite data..when this sprite clicked
add (join (join (join (join (join (username) [ - ]) (Part 1)) (Part 2)) (Part 3)) (Part 4)) to [Save data v]
when this sprite clicked
add (join (join (join (join (join (username) [ - ]) (☁ Part 1)) (☁ Part 2)) (☁ Part 3)) (☁ Part 4)) to [Save data v]
And even then I'm still sure that wouldn't work…
Last edited by csf27278 (April 20, 2016 15:33:24)
- deck26
-
1000+ posts
Saving progress in a game to individual users?
That post was over a year ago and perhaps best left undisturbedYah It won't save, But if your working with numbers, part 1 part 2 so on and so forth could be cloud variables There is a simple script to save, but I can't get it to overwrite data..when this sprite clicked
add (join (join (join (join (join (username) [ - ]) (Part 1)) (Part 2)) (Part 3)) (Part 4)) to [Save data v]when this sprite clicked
add (join (join (join (join (join (username) [ - ]) (☁ Part 1)) (☁ Part 2)) (☁ Part 3)) (☁ Part 4)) to [Save data v]

- Mole_Gaming
-
100+ posts
Saving progress in a game to individual users?
The way I would do it is store two lists- one with the users, and the other with the data for them. So you can just have a
repeat until <(item (count) of [users v]) = (username)>You could also store more lists for more data so you wouldn't have to separate it from one large string like the other suggestions say.
change [count v] by (1)
end
//then, the user's data would just be
(item (count) of [save data v])
- deck26
-
1000+ posts
Saving progress in a game to individual users?
@Mole_Gaming - this is an old topic. The way I would do it is store two lists- one with the users, and the other with the data for them. So you can just have arepeat until <(item (count) of [users v]) = (username)>You could also store more lists for more data so you wouldn't have to separate it from one large string like the other suggestions say.
change [count v] by (1)
end
//then, the user's data would just be
(item (count) of [save data v])
- Ted_The_Hedgehog
-
47 posts
Saving progress in a game to individual users?
@Mole_Gaming - this is an old topic. The way I would do is store two lists- one with the users, and the other with the data for them. So you can just have arepeat until <(item (count) of [users v]) = (username)>You could also store more lists for more data so you wouldn't have to separate it from one large string like the other suggestions say.
change [count v] by (1)
end
//then, the user's data would just be
(item (count) of [save data v])
Not anymore. It has been disturbed. It has already begun.

- reynaldobato
-
11 posts
Saving progress in a game to individual users?
Yah It won't save, But if your working with numbers, part 1 part 2 so on and so forth could be cloud variables There is a simple script to save, but I can't get it to overwrite data..when this sprite clicked
add (join (join (join (join (join (username) [ - ]) (Part 1)) (Part 2)) (Part 3)) (Part 4)) to [Save data v]when this sprite clicked
add (join (join (join (join (join (username) [ - ]) (☁ Part 1)) (☁ Part 2)) (☁ Part 3)) (☁ Part 4)) to [Save data v]
And even then I'm still sure that wouldn't work…
It works!
- LuigiEXEVI
-
22 posts
Saving progress in a game to individual users?
Yah It won't save, But if your working with numbers, part 1 part 2 so on and so forth could be cloud variables There is a simple script to save, but I can't get it to overwrite data..when this sprite clicked
add (join (join (join (join (join (username) [ - ]) (Part 1)) (Part 2)) (Part 3)) (Part 4)) to [Save data v]when this sprite clicked
add (join (join (join (join (join (username) [ - ]) (☁ Part 1)) (☁ Part 2)) (☁ Part 3)) (☁ Part 4)) to [Save data v]
And even then I'm still sure that wouldn't work…
It works!
It works? For real? Like for every individual user?
- deck26
-
1000+ posts
Saving progress in a game to individual users?
Yah It won't save, But if your working with numbers, part 1 part 2 so on and so forth could be cloud variables There is a simple script to save, but I can't get it to overwrite data..when this sprite clicked
add (join (join (join (join (join (username) [ - ]) (Part 1)) (Part 2)) (Part 3)) (Part 4)) to [Save data v]when this sprite clicked
add (join (join (join (join (join (username) [ - ]) (☁ Part 1)) (☁ Part 2)) (☁ Part 3)) (☁ Part 4)) to [Save data v]
And even then I'm still sure that wouldn't work…
It works!
It works? For real? Like for every individual user?
No it doesn't work - cloud varaibles cannot hold unencoded usernames.
Please try to avoid necroposting.
- Discussion Forums
- » Help with Scripts
-
» Saving progress in a game to individual users?