Discuss Scratch

SuperGamerGG2
Scratcher
69 posts

How to create save codes?

Hello, I'm trying to make a save code mechanism in the “save data” sprite, but I just stuck. Please help me!
https://scratch.mit.edu/projects/969611148/editor/

Hi! I'm SuperGamerGG2. Click on the links below!

My Profile | Define Scratch | My BFB Camp Team | Game
MineTurte
Scratcher
500+ posts

How to create save codes?

SuperGamerGG2 wrote:

Hello, I'm trying to make a save code mechanism in the “save data” sprite, but I just stuck. Please help me!
https://scratch.mit.edu/projects/969611148/editor/
Well it depends. If you want it so people can't easily just alter it you'll either have to use some really advanced encoder, or just hide the code by editing the JSON file. If @Malicondi happens to see this post he can probably provide you with a link on how to edit the JSON file, cuz I don't know how lol.

But if you don't mind people being able to change it then:
when I receive [ generate code]
set [ code] to (join [username] (join [|] (join (coins) [|])))

If you need the decoding script too, ask.
Hope I helped btw!

(pronouns are she/her). Advanced Alpha Game Studios Manager; website: https://aags2.w3spaces.com
This is JuniperActias. AKA Moth mommy. If I helped you out consider following Juni-Bug (my new account)!




If you found this secret, say uwu
Signature gradients here













SuperGamerGG2
Scratcher
69 posts

How to create save codes?

MineTurte wrote:

SuperGamerGG2 wrote:

Hello, I'm trying to make a save code mechanism in the “save data” sprite, but I just stuck. Please help me!
https://scratch.mit.edu/projects/969611148/editor/
Well it depends. If you want it so people can't easily just alter it you'll either have to use some really advanced encoder, or just hide the code by editing the JSON file. If @Malicondi happens to see this post he can probably provide you with a link on how to edit the JSON file, cuz I don't know how lol.

But if you don't mind people being able to change it then:
when I receive [ generate code]
set [ code] to (join [username] (join [|] (join (coins) [|])))

If you need the decoding script too, ask.
Hope I helped btw!
yes i need help decoding it. pls

Hi! I'm SuperGamerGG2. Click on the links below!

My Profile | Define Scratch | My BFB Camp Team | Game
MineTurte
Scratcher
500+ posts

How to create save codes?

SuperGamerGG2 wrote:

MineTurte wrote:

SuperGamerGG2 wrote:

Hello, I'm trying to make a save code mechanism in the “save data” sprite, but I just stuck. Please help me!
https://scratch.mit.edu/projects/969611148/editor/
Well it depends. If you want it so people can't easily just alter it you'll either have to use some really advanced encoder, or just hide the code by editing the JSON file. If @Malicondi happens to see this post he can probably provide you with a link on how to edit the JSON file, cuz I don't know how lol.

But if you don't mind people being able to change it then:
when I receive [ generate code]
set [ code] to (join [username] (join [|] (join (coins) [|])))

If you need the decoding script too, ask.
Hope I helped btw!
yes i need help decoding it. pls

Here:
when I receive [ encode]
set [ code] to (join (username) (join [|] (join (coins) [|])))

define decode (what to decode)//set to run without screen refresh
set [ letter] to [0]
set [ temporaryCoins] to [] //Make sure this is blank, no space or anything.
set [ fetchedUsername] to [] //Also set to blank.
repeat until <(letter (letter) of ([what to decode])) = [|]>
change [ letter] by (1)
if <not <(letter (letter) of ([what to decode])) = [|]>> then
set [ fetchedUsername] to (join (fetchedUsername) (letter (letter) of ([what to decode])))
end
end
change [ letter] by (1)
repeat until <(letter (letter) of ([what to decode])) = [|]>
change [ letter] by (1)
if <not <(letter (letter) of ([what to decode])) = [|]>> then
set [ temporaryCoins] to (join (temporaryCoins) (letter (letter) of ([what to decode])))
end
end
if <(username) = [fetchedUsername]> then
set [ coins] to []
end

Basically this just goes through every letter starting at 1 and until it hits a | it keeps adding the letter of whats encoded to whatever is first (for this example it's your username). Once it reaches a | it stops adding letters to your username and skips the | then starts to add the letters fetched to the temporaryCoins. Once it reaches another | it stops finally and checks if you username equals the one fetched, if so then it sets your coins to the coins fetched.

Hope this helps! (And works lol. I believe it does but I'm not too sure.)

(pronouns are she/her). Advanced Alpha Game Studios Manager; website: https://aags2.w3spaces.com
This is JuniperActias. AKA Moth mommy. If I helped you out consider following Juni-Bug (my new account)!




If you found this secret, say uwu
Signature gradients here













Malicondi
Scratcher
1000+ posts

How to create save codes?

MineTurte wrote:

Well it depends. If you want it so people can't easily just alter it you'll either have to use some really advanced encoder, or just hide the code by editing the JSON file. If @Malicondi happens to see this post he can probably provide you with a link on how to edit the JSON file, cuz I don't know how lol.
Sorry, I can't give anyone that, it's technically against the Terms of Use :p

post #1000 post #100 i help in the forums post #1 post #500 0 second ninja
I recommend reading jvvg's essay about the scratch team before complaining, as it may change your opinion and provide insight on the topic.

coming soon :)


SuperGamerGG2
Scratcher
69 posts

How to create save codes?

MineTurte wrote:

SuperGamerGG2 wrote:

MineTurte wrote:

SuperGamerGG2 wrote:

Hello, I'm trying to make a save code mechanism in the “save data” sprite, but I just stuck. Please help me!
https://scratch.mit.edu/projects/969611148/editor/
Well it depends. If you want it so people can't easily just alter it you'll either have to use some really advanced encoder, or just hide the code by editing the JSON file. If @Malicondi happens to see this post he can probably provide you with a link on how to edit the JSON file, cuz I don't know how lol.

But if you don't mind people being able to change it then:
when I receive [ generate code]
set [ code] to (join [username] (join [|] (join (coins) [|])))

If you need the decoding script too, ask.
Hope I helped btw!
yes i need help decoding it. pls

Here:
when I receive [ encode]
set [ code] to (join (username) (join [|] (join (coins) [|])))

define decode (what to decode)//set to run without screen refresh
set [ letter] to [0]
set [ temporaryCoins] to [] //Make sure this is blank, no space or anything.
set [ fetchedUsername] to [] //Also set to blank.
repeat until <(letter (letter) of ([what to decode])) = [|]>
change [ letter] by (1)
if <not <(letter (letter) of ([what to decode])) = [|]>> then
set [ fetchedUsername] to (join (fetchedUsername) (letter (letter) of ([what to decode])))
end
end
change [ letter] by (1)
repeat until <(letter (letter) of ([what to decode])) = [|]>
change [ letter] by (1)
if <not <(letter (letter) of ([what to decode])) = [|]>> then
set [ temporaryCoins] to (join (temporaryCoins) (letter (letter) of ([what to decode])))
end
end
if <(username) = [fetchedUsername]> then
set [ coins] to []
end

Basically this just goes through every letter starting at 1 and until it hits a | it keeps adding the letter of whats encoded to whatever is first (for this example it's your username). Once it reaches a | it stops adding letters to your username and skips the | then starts to add the letters fetched to the temporaryCoins. Once it reaches another | it stops finally and checks if you username equals the one fetched, if so then it sets your coins to the coins fetched.

Hope this helps! (And works lol. I believe it does but I'm not too sure.)
i starting to use griffpatch's tutorial. this is pretty much the same! Thanks anyway!
when problem [solved v]
broadcast [be happy v]
stop [this script v]

Hi! I'm SuperGamerGG2. Click on the links below!

My Profile | Define Scratch | My BFB Camp Team | Game
SuperGamerGG2
Scratcher
69 posts

How to create save codes?

Malicondi wrote:

MineTurte wrote:

Well it depends. If you want it so people can't easily just alter it you'll either have to use some really advanced encoder, or just hide the code by editing the JSON file. If @Malicondi happens to see this post he can probably provide you with a link on how to edit the JSON file, cuz I don't know how lol.
Sorry, I can't give anyone that, it's technically against the Terms of Use :p
oh.

Hi! I'm SuperGamerGG2. Click on the links below!

My Profile | Define Scratch | My BFB Camp Team | Game

Powered by DjangoBB