Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How do i make a save button?
- ANEvans14
-
Scratcher
27 posts
How do i make a save button?
I have been making a game, and want to have an in game save button.
I don't know how to code this button what so ever. I just need a save button so that the players can save when every they want to so that when they replay the game, it starts them back up where they were and with the items they had.
Here is a link to the game: Liz World
it isn't complete yet since i still have to make upgrades.
If you can help me, i'll put you as a collaborator in the project.
Thank you
~ANEvans14
I don't know how to code this button what so ever. I just need a save button so that the players can save when every they want to so that when they replay the game, it starts them back up where they were and with the items they had.
Here is a link to the game: Liz World
it isn't complete yet since i still have to make upgrades.
If you can help me, i'll put you as a collaborator in the project.
Thank you
~ANEvans14
Last edited by ANEvans14 (Aug. 19, 2014 23:06:57)
- 1234abcdcba4321
-
Scratcher
1000+ posts
How do i make a save button?
Making a save button is really complicated.
To get started, you should just use the basic code exports: When they press save, give them a code for them to copy and keep somewhere safe, then, when you load up the game, have the option to load the game, where it asks you what the save code was, then it gives you save data depending on what the code was.
The alternative is much more complicated and isn't reliable.
To get started, you should just use the basic code exports: When they press save, give them a code for them to copy and keep somewhere safe, then, when you load up the game, have the option to load the game, where it asks you what the save code was, then it gives you save data depending on what the code was.
The alternative is much more complicated and isn't reliable.
- ANEvans14
-
Scratcher
27 posts
How do i make a save button?
Making a save button is really complicated.
To get started, you should just use the basic code exports: When they press save, give them a code for them to copy and keep somewhere safe, then, when you load up the game, have the option to load the game, where it asks you what the save code was, then it gives you save data depending on what the code was.
The alternative is much more complicated and isn't reliable.
Okay, thanks that really helped! Do you have a code example of how it would work in a project?
- 1234abcdcba4321
-
Scratcher
1000+ posts
How do i make a save button?
Making a save button is really complicated.
To get started, you should just use the basic code exports: When they press save, give them a code for them to copy and keep somewhere safe, then, when you load up the game, have the option to load the game, where it asks you what the save code was, then it gives you save data depending on what the code was.
The alternative is much more complicated and isn't reliable.
Okay, thanks that really helped! Do you have a code example of how it would work in a project?
Well, I can make one!
when green flag clicked
ask [Load save game? (y/n)] and wait
if <(answer) = [y]> then
ask [what's your save code?] and wait
set [level v] to (join (join (letter (1) of (answer)) (letter (2) of (answer))) (join (letter (3) of (answer)) (letter (4) of (answer))))
set [place v] to (join (letter (5) of (answer)) (letter (6) of (answer)))
etc etc... ::grey gray
else
broadcast [new game v]
end
when I receive [save game v]
delete (last v) of [YOUR SAVE CODE v]
add (join (join (level) (place)) ()) to [YOUR SAVE CODE v] //add more to it, obviously
This needs all the variables to always be at a set length, though. (So level would be 4 digits, place would be 2 digits, etc.)
- ANEvans14
-
Scratcher
27 posts
How do i make a save button?
Making a save button is really complicated.
To get started, you should just use the basic code exports: When they press save, give them a code for them to copy and keep somewhere safe, then, when you load up the game, have the option to load the game, where it asks you what the save code was, then it gives you save data depending on what the code was.
The alternative is much more complicated and isn't reliable.
Okay, thanks that really helped! Do you have a code example of how it would work in a project?
Well, I can make one!when green flag clicked
ask [Load save game? (y/n)] and wait
if <(answer) = [y]> then
ask [what's your save code?] and wait
set [level v] to (join (join (letter (1) of (answer)) (letter (2) of (answer))) (join (letter (3) of (answer)) (letter (4) of (answer))))
set [place v] to (join (letter (5) of (answer)) (letter (6) of (answer)))
etc etc... ::grey gray
else
broadcast [new game v]
end
when I receive [save game v]
delete (last v) of [YOUR SAVE CODE v]
add (join (join (level) (place)) ()) to [YOUR SAVE CODE v] //add more to it, obviously
This needs all the variables to always be at a set length, though. (So level would be 4 digits, place would be 2 digits, etc.)
Okay! Thank you!!

- amysdigitalescape
-
New Scratcher
2 posts
How do i make a save button?
Making a save button is really complicated.
To get started, you should just use the basic code exports: When they press save, give them a code for them to copy and keep somewhere safe, then, when you load up the game, have the option to load the game, where it asks you what the save code was, then it gives you save data depending on what the code was.
The alternative is much more complicated and isn't reliable.
Okay, thanks that really helped! Do you have a code example of how it would work in a project?
Well, I can make one!when green flag clicked
ask [Load save game? (y/n)] and wait
if <(answer) = [y]> then
ask [what's your save code?] and wait
set [level v] to (join (join (letter (1) of (answer)) (letter (2) of (answer))) (join (letter (3) of (answer)) (letter (4) of (answer))))
set [place v] to (join (letter (5) of (answer)) (letter (6) of (answer)))
etc etc... ::grey gray
else
broadcast [new game v]
end
when I receive [save game v]
delete (last v) of [YOUR SAVE CODE v]
add (join (join (level) (place)) ()) to [YOUR SAVE CODE v] //add more to it, obviously
This needs all the variables to always be at a set length, though. (So level would be 4 digits, place would be 2 digits, etc.)
How did you get the etc etc grey block?
- ivancr72
-
Scratcher
100+ posts
How do i make a save button?
It's not in scratch, just in scratchblocks.Making a save button is really complicated.
To get started, you should just use the basic code exports: When they press save, give them a code for them to copy and keep somewhere safe, then, when you load up the game, have the option to load the game, where it asks you what the save code was, then it gives you save data depending on what the code was.
The alternative is much more complicated and isn't reliable.
Okay, thanks that really helped! Do you have a code example of how it would work in a project?
Well, I can make one!when green flag clicked
ask [Load save game? (y/n)] and wait
if <(answer) = [y]> then
ask [what's your save code?] and wait
set [level v] to (join (join (letter (1) of (answer)) (letter (2) of (answer))) (join (letter (3) of (answer)) (letter (4) of (answer))))
set [place v] to (join (letter (5) of (answer)) (letter (6) of (answer)))
etc etc... ::grey gray
else
broadcast [new game v]
end
when I receive [save game v]
delete (last v) of [YOUR SAVE CODE v]
add (join (join (level) (place)) ()) to [YOUR SAVE CODE v] //add more to it, obviously
This needs all the variables to always be at a set length, though. (So level would be 4 digits, place would be 2 digits, etc.)
How did you get the etc etc grey block?
- amysdigitalescape
-
New Scratcher
2 posts
How do i make a save button?
It's not in scratch, just in scratchblocks.Making a save button is really complicated.
To get started, you should just use the basic code exports: When they press save, give them a code for them to copy and keep somewhere safe, then, when you load up the game, have the option to load the game, where it asks you what the save code was, then it gives you save data depending on what the code was.
The alternative is much more complicated and isn't reliable.
Okay, thanks that really helped! Do you have a code example of how it would work in a project?
Well, I can make one!when green flag clicked
ask [Load save game? (y/n)] and wait
if <(answer) = [y]> then
ask [what's your save code?] and wait
set [level v] to (join (join (letter (1) of (answer)) (letter (2) of (answer))) (join (letter (3) of (answer)) (letter (4) of (answer))))
set [place v] to (join (letter (5) of (answer)) (letter (6) of (answer)))
etc etc... ::grey gray
else
broadcast [new game v]
end
when I receive [save game v]
delete (last v) of [YOUR SAVE CODE v]
add (join (join (level) (place)) ()) to [YOUR SAVE CODE v] //add more to it, obviously
This needs all the variables to always be at a set length, though. (So level would be 4 digits, place would be 2 digits, etc.)
How did you get the etc etc grey block?
oooooooh oKK
- TheOneLedgend
-
Scratcher
5 posts
How do i make a save button?
For Backdrop Coding do this:
Then make a new sprite that on it says “Save”
For the script is:
For the script is:
when green flag clickedThen make a cloud variable named “saved”
set [health] to [0]
Then make a new sprite that on it says “Save”
For the script is:
when this sprite clickedThen make another sprite that says “Load”
change [saved] by (health)
set [health] to [0]
For the script is:
when this sprite clicked
change [health] by (saved)
set [saved] to [0]
Last edited by TheOneLedgend (Nov. 4, 2016 18:00:38)
- TheOneLedgend
-
Scratcher
5 posts
How do i make a save button?
That was my good short way and also you can hide the cloud variable by right clicking on it and clicking hide so that you have more space in your game!!!
- Dinoco2005
-
Scratcher
45 posts
How do i make a save button?
If someone keeps loading and saving they could easily get a lot of health, also this would not work for more than one person.
- TariqjeMaakt
-
Scratcher
93 posts
How do i make a save button?
Founded a easier code (only for games with levels)
If the level 1 code is 1953…
And level 2 code is 2944
And level 3 code is 3855
If the level 1 code is 1953…
And level 2 code is 2944
And level 3 code is 3855
when green flag clicked
ask [Code?] and wait
if <(answer) = [1953]> then
start level 1
end
if <(answer) = [2944]> then
start level 2
end
if <(answer) = [3855]> then
start level 3
end
Last edited by TariqjeMaakt (Jan. 3, 2017 19:40:59)
- Th3_C0d3r
-
Scratcher
100+ posts
How do i make a save button?
The only problem with this kind of saving code is that it can be easily, “Hack/cheated” All a user would have to do is just looks at the script, copy the, “Secret code” he/she wants, and BAMMM that player can be at all the levels. I recommend using Cloud saving techniques to avoid such problems.
-Merry Christmas
-Merry Christmas
- Th3_C0d3r
-
Scratcher
100+ posts
How do i make a save button?
Please don't necropost.How am I, “Necroposting?”
- asivi
-
Scratcher
1000+ posts
How do i make a save button?
Now see the date for the original post. https://scratch.mit.edu/discuss/post/414029/
Greets.
Greets.
- Th3_C0d3r
-
Scratcher
100+ posts
How do i make a save button?
Sarcasm is unnecessary.
That post was more for the others who posted above to be aware of a, “Flaw” in their system. As well as others who might see this thread now.
-Merry Christmas
That post was more for the others who posted above to be aware of a, “Flaw” in their system. As well as others who might see this thread now.
-Merry Christmas
- Game_creator64
-
Scratcher
3 posts
How do i make a save button?
how do u edit the date stack blocks from last to your save code?Making a save button is really complicated.
To get started, you should just use the basic code exports: When they press save, give them a code for them to copy and keep somewhere safe, then, when you load up the game, have the option to load the game, where it asks you what the save code was, then it gives you save data depending on what the code was.
The alternative is much more complicated and isn't reliable.
Okay, thanks that really helped! Do you have a code example of how it would work in a project?
Well, I can make one!when green flag clicked
ask [Load save game? (y/n)] and wait
if <(answer) = [y]> then
ask [what's your save code?] and wait
set [level v] to (join (join (letter (1) of (answer)) (letter (2) of (answer))) (join (letter (3) of (answer)) (letter (4) of (answer))))
set [place v] to (join (letter (5) of (answer)) (letter (6) of (answer)))
etc etc... ::grey gray
else
broadcast [new game v]
end
when I receive [save game v]
delete (last v) of [YOUR SAVE CODE v]
add (join (join (level) (place)) ()) to [YOUR SAVE CODE v] //add more to it, obviously
This needs all the variables to always be at a set length, though. (So level would be 4 digits, place would be 2 digits, etc.)
- deck26
-
Scratcher
1000+ posts
How do i make a save button?
Much better to start your own topic rather than necropost. You can always refer to this one if necessary.how do u edit the date stack blocks from last to your save code?Making a save button is really complicated.
To get started, you should just use the basic code exports: When they press save, give them a code for them to copy and keep somewhere safe, then, when you load up the game, have the option to load the game, where it asks you what the save code was, then it gives you save data depending on what the code was.
The alternative is much more complicated and isn't reliable.
Okay, thanks that really helped! Do you have a code example of how it would work in a project?
Well, I can make one!when green flag clicked
ask [Load save game? (y/n)] and wait
if <(answer) = [y]> then
ask [what's your save code?] and wait
set [level v] to (join (join (letter (1) of (answer)) (letter (2) of (answer))) (join (letter (3) of (answer)) (letter (4) of (answer))))
set [place v] to (join (letter (5) of (answer)) (letter (6) of (answer)))
etc etc... ::grey gray
else
broadcast [new game v]
end
when I receive [save game v]
delete (last v) of [YOUR SAVE CODE v]
add (join (join (level) (place)) ()) to [YOUR SAVE CODE v] //add more to it, obviously
This needs all the variables to always be at a set length, though. (So level would be 4 digits, place would be 2 digits, etc.)
- Discussion Forums
- » Help with Scripts
-
» How do i make a save button?