Discuss Scratch

FriesAndKetchup123
Scratcher
64 posts

How do you make a project with SAVE CODES?


I DO NOT NEED HELP ON THIS TOPIC ANYMORE AS I HAVE FOUND THE ANSWER!

Hi everyone! I am super confused! How do you make a save code for your project? I am wondering, if you make a say. . . “dress the dog” game or something, how would you code a save code and be able to load it! (If you do not understand what I am meaning, look below at the star)* Please help me by either, explaining it in this forum or making a project demonstrating what it should be like and post the link on this forum! Thank you, FriesAndKetchup123

*Help to understand: I am wondering how you are able to code your project where if someone is on it, they can save the code and be able to click “load code” to load the looks! Please help me by either, explaining it in this forum or making a project demonstrating what it should be like and post the link on this forum!

when green flag clicked
play sound [Please help! v] until done
forever
if <key [REMIX v] pressed?> then
set [Help v] to [Done]
end
end

Last edited by FriesAndKetchup123 (Jan. 14, 2022 18:05:25)

XretroperX
Scratcher
100+ posts

How do you make a project with SAVE CODES?

I made a project that utilizes this very well: https://scratch.mit.edu/272276019.

It's a clicker game, so I made it multiply some of the variables I wanted to save, then combined the number into codes that could be loaded in, then divided them by what they were multiplied by to give back the exact number. You can analyze the project above if you need a visual.
CamG777
Scratcher
100+ posts

How do you make a project with SAVE CODES?

The way a save code works, is it assigns a value to each part of you project and puts them all together. Lets say with your dress a dog, you had

4 Hat options
11 Shirt options
7 Shoe options

You would store the value of each in a variable. The first costume would be named 1. This code could make the save code.

set [Save Code v] to []
set [Save Code v] to (join (Save Code) (Hat))
if <(Shirt) > [9]> then
set [Save Code v] to (join (Save Code) (Shirt))


else
set [Save Code v] to (join (Save Code)(join (0) (Shirt)))
end
set [Save Code v] to (join (Save Code) (Shoe))

This will give you a save code. With shirt since it has 2 digits of options, we need to make sure it's always a 2 digit number in the save code. So if it's a 1 digit number(Less then 10), we need to add a zero in front of it.

Now to decode

ask [Code?] and wait
set [Code v] to (answer)
set [Hat v] to (letter (1) of (Code))
set [Shirt v] to (join (letter (2) of (Code))(letter (3) of (Code)))
set [Shoe v] to (letter (4) of (Code))

This works by taking the save code and putting it back to the variables that it was made from!
Hopes this helps!
FriesAndKetchup123
Scratcher
64 posts

How do you make a project with SAVE CODES?

XretroperX wrote:

I made a project that utilizes this very well: https://scratch.mit.edu/272276019.

It's a clicker game, so I made it multiply some of the variables I wanted to save, then combined the number into codes that could be loaded in, then divided them by what they were multiplied by to give back the exact number. You can analyze the project above if you need a visual.

Hi, XretroperX! Thanks, but maybe check that your project there is shared, because when I use the link, it says it is not shared, so could you check that it is shared please! Thank you!
XretroperX
Scratcher
100+ posts

How do you make a project with SAVE CODES?

CamG777 wrote:

The way a save code works, is it assigns a value to each part of you project and puts them all together. Lets say with your dress a dog, you had

4 Hat options
11 Shirt options
7 Shoe options

You would store the value of each in a variable. The first costume would be named 1. This code could make the save code.

set [Save Code v] to []
set [Save Code v] to (join (Save Code) (Hat))
if <(Shirt) > [9]> then
set [Save Code v] to (join (Save Code) (Shirt))


else
set [Save Code v] to (join (Save Code)(join (0) (Shirt)))
end
set [Save Code v] to (join (Save Code) (Shoe))

This will give you a save code. With shirt since it has 2 digits of options, we need to make sure it's always a 2 digit number in the save code. So if it's a 1 digit number(Less then 10), we need to add a zero in front of it.

Now to decode

ask [Code?] and wait
set [Code v] to (answer)
set [Hat v] to (letter (1) of (Code))
set [Shirt v] to (join (letter (2) of (Code))(letter (3) of (Code)))
set [Shoe v] to (letter (4) of (Code))

This works by taking the save code and putting it back to the variables that it was made from!
Hopes this helps!

ok so this is far more efficient than what I used in my project lol, thanks
XretroperX
Scratcher
100+ posts

How do you make a project with SAVE CODES?

FriesAndKetchup123 wrote:

XretroperX wrote:

I made a project that utilizes this very well: https://scratch.mit.edu/272276019.

It's a clicker game, so I made it multiply some of the variables I wanted to save, then combined the number into codes that could be loaded in, then divided them by what they were multiplied by to give back the exact number. You can analyze the project above if you need a visual.

Hi, XretroperX! Thanks, but maybe check that your project there is shared, because when I use the link, it says it is not shared, so could you check that it is shared please! Thank you!
https://scratch.mit.edu/projects/272276019
I forgot to add projects in the link lol
FriesAndKetchup123
Scratcher
64 posts

How do you make a project with SAVE CODES?

CamG777 wrote:

The way a save code works, is it assigns a value to each part of you project and puts them all together. Lets say with your dress a dog, you had

4 Hat options
11 Shirt options
7 Shoe options

You would store the value of each in a variable. The first costume would be named 1. This code could make the save code.

set [Save Code v] to []
set [Save Code v] to (join (Save Code) (Hat))
if <(Shirt) > [9]> then
set [Save Code v] to (join (Save Code) (Shirt))


else
set [Save Code v] to (join (Save Code)(join (0) (Shirt)))
end
set [Save Code v] to (join (Save Code) (Shoe))

This will give you a save code. With shirt since it has 2 digits of options, we need to make sure it's always a 2 digit number in the save code. So if it's a 1 digit number(Less then 10), we need to add a zero in front of it.

Now to decode

ask [Code?] and wait
set [Code v] to (answer)
set [Hat v] to (letter (1) of (Code))
set [Shirt v] to (join (letter (2) of (Code))(letter (3) of (Code)))
set [Shoe v] to (letter (4) of (Code))

This works by taking the save code and putting it back to the variables that it was made from!
Hopes this helps!

Thank you CamG777! I am very sorry, as I didn't understand that thoroughly! If you try making a project using that code and posting the link on this forum, I will look at that and get an idea of what it should be like! Thx again!
CamG777
Scratcher
100+ posts

How do you make a project with SAVE CODES?

FriesAndKetchup123 wrote:

CamG777 wrote:

The way a save code works, is it assigns a value to each part of you project and puts them all together. Lets say with your dress a dog, you had

4 Hat options
11 Shirt options
7 Shoe options

You would store the value of each in a variable. The first costume would be named 1. This code could make the save code.

set [Save Code v] to []
set [Save Code v] to (join (Save Code) (Hat))
if <(Shirt) > [9]> then
set [Save Code v] to (join (Save Code) (Shirt))


else
set [Save Code v] to (join (Save Code)(join (0) (Shirt)))
end
set [Save Code v] to (join (Save Code) (Shoe))

This will give you a save code. With shirt since it has 2 digits of options, we need to make sure it's always a 2 digit number in the save code. So if it's a 1 digit number(Less then 10), we need to add a zero in front of it.

Now to decode

ask [Code?] and wait
set [Code v] to (answer)
set [Hat v] to (letter (1) of (Code))
set [Shirt v] to (join (letter (2) of (Code))(letter (3) of (Code)))
set [Shoe v] to (letter (4) of (Code))

This works by taking the save code and putting it back to the variables that it was made from!
Hopes this helps!

Thank you CamG777! I am very sorry, as I didn't understand that thoroughly! If you try making a project using that code and posting the link on this forum, I will look at that and get an idea of what it should be like! Thx again!

Okay!
CamG777
Scratcher
100+ posts

How do you make a project with SAVE CODES?

FriesAndKetchup123
Scratcher
64 posts

How do you make a project with SAVE CODES?

CamG777 wrote:

https://scratch.mit.edu/projects/628579767/
Thank you for the link, @CamG777
FriesAndKetchup123
Scratcher
64 posts

How do you make a project with SAVE CODES?

CamG777 wrote:

https://scratch.mit.edu/projects/628579767/
Thank you so much @CamG777

I have made a test game and included you in the notes/credits, as I used part of your code!

Here is the Link to my test save codes game: https://scratch.mit.edu/projects/628596722
NanoBug_
Scratcher
78 posts

How do you make a project with SAVE CODES?

FriesAndKetchup123 wrote:

XretroperX wrote:

I made a project that utilizes this very well: https://scratch.mit.edu/272276019.

It's a clicker game, so I made it multiply some of the variables I wanted to save, then combined the number into codes that could be loaded in, then divided them by what they were multiplied by to give back the exact number. You can analyze the project above if you need a visual.

Hi, XretroperX! Thanks, but maybe check that your project there is shared, because when I use the link, it says it is not shared, so could you check that it is shared please! Thank you!
The link that he should have put is : https://scratch.mit.edu/projects/272276019

Last edited by NanoBug_ (Jan. 14, 2022 18:58:38)

FriesAndKetchup123
Scratcher
64 posts

How do you make a project with SAVE CODES?

NanoBug_ wrote:

FriesAndKetchup123 wrote:

XretroperX wrote:

I made a project that utilizes this very well: https://scratch.mit.edu/272276019.

It's a clicker game, so I made it multiply some of the variables I wanted to save, then combined the number into codes that could be loaded in, then divided them by what they were multiplied by to give back the exact number. You can analyze the project above if you need a visual.

Hi, XretroperX! Thanks, but maybe check that your project there is shared, because when I use the link, it says it is not shared, so could you check that it is shared please! Thank you!
The link that he should have put is : https://scratch.mit.edu/projects/272276019
ok! thx! Although I have already found out how to make a save code now!
EAE_animator
Scratcher
37 posts

How do you make a project with SAVE CODES?

define 

Powered by DjangoBB