Discuss Scratch

Infernus-TBB
Scratcher
1 post

How do i make a save system?

So, im making a pretty big project. And because progression would take a while, you arent beating the whole thing in one sitting. So i wanted to add a save system so people could copy a code and keep it somewhere for the next time they play it.

I just dont exactly know how id code this (and i dont really wanna steal code from other projects to do it)

What would be saved:
Obtained Units
Progression (chapter, mode, level, difficulty)
Unit Levels
EXP
another currency

uhh yeah
TheFatPurpleChicken
Scratcher
50 posts

How do i make a save system?

I have the same question to. I do know though you have to make a list and do something with that.
GameCatastrophe0927
Scratcher
1000+ posts

How do i make a save system?

Here's a thing I used for my project: (copy and paste from another post I made)

delete all of [save code create v]
add [thing] to [save code create v]
add [thing] to [save code create v]
repeat for everything you want to save, make sure that either none of them can possibly be longer than 1 character OR at least one of them is 2 characters or longer
replace item (2 v) of [Copy and paste v] with (list :: list)
“Copy and paste” looks something like this:
Line 1 - Copy and paste this save code!
Line 2 - (this gets replaced with the save code)
Line 3 - Click anywhere else to exit. (or whatever you want to do for your game)

Then you make a way to read save codes when loading them. I did this for one of my games so you can use that if you want.
Olimon7661
Scratcher
1000+ posts

How do i make a save system?

Griffpatch made a tutorial here: https://youtu.be/g-9RcbQIQWE?si=mYqtl6agKMT5T_UM
PaSc_Clan
Scratcher
100+ posts

How do i make a save system?

(data :: list) // List of data to save
(index) // Repeat Counter
(item) // Item from save

define saveData // Run without screen refresh.
set [index v] to [0]
set [item v] to []
repeat ((length of [data v]) - [1])
set [item v] to (join (item (index) of [data v]) [,])
end
set [item v] to (item ((index) + [1]) of [data v])

define loadData (data) // Run without screen refresh
delete all of [data v]
set [index v] to [0]
set [item v] to []
repeat (length of (data))
if <(letter (index) of (data)) = [,]> then
add (item) to [data v]
set [item v] to []
else
set [item v] to (join (item) (letter (index) of (data)))
end
end
add (item) to [data v]

saveData

ask [Paste your save data.] and wait
loadData (answer)
Sedef-Eercc
Scratcher
100+ posts

How do i make a save system?

I’ve heard you need to use cloud variables but they are currently not working
zeiraph
Scratcher
100+ posts

How do i make a save system?

Sedef-Eercc wrote:

I’ve heard you need to use cloud variables but they are currently not working
Only some methods use cloud variables

Last edited by zeiraph (Feb. 7, 2025 21:31:13)

boxerry
Scratcher
1000+ posts

How do i make a save system?

Sedef-Eercc wrote:

I’ve heard you need to use cloud variables but they are currently not working

I don't think you need cloud variables in every option though.
sh4dow_05
Scratcher
57 posts

How do i make a save system?

Short answer:
when green flag clicked
forever
reset timer // Do not use this method if the timer is being used
end
when [timer v] > (0.1)
set (save code v) to (pick random (00000) to (99999)) // Insert game data on the save code too
say (join [Your save code is] (save code))
when green flag clicked
ask [Do you have a save code?] and wait
forever
if <(answer) = [Yes]> then
ask [Enter save code] and wait
load (save code) :: custom
end
end

This is the most simple you can do.
GameCatastrophe0927
Scratcher
1000+ posts

How do i make a save system?

sh4dow_05 wrote:

Short answer:
etc.
This is the most simple you can do.
That's not really a good option since you can't copy-and-paste plus you have to stop the project in order to save.

Last edited by GameCatastrophe0927 (Feb. 11, 2025 00:24:18)

sh4dow_05
Scratcher
57 posts

How do i make a save system?

Well, as I said, that is the most simple you can do. The person who uses the script can also edit it to their liking.
bsteichman
Scratcher
500+ posts

How do i make a save system?

first, pick a good separator character, I will pick “§” as it is an uncommon character

since it seems you do not need to save a large varying amount of data (EX, a whole map and all the positions), it seems you just want to save variables, which makes it easier…
here is what I came up with:

define make save code
delete all of [split v]
add (units) to [split v]
add (chapter) to [split v]
add (mode) to [split v]
add (level) to [split v]
add (difficulty) to [split v]
add (XP) to [split v]
add (gems) to [split v]
set [i v] to [0]
set [text v] to []
repeat (length of [split v] :: list)
set [text v] to (join (text) (join (item (i) of [split v] :: list) [§]))
change [i v] by (1)
end
delete all of [copy me!! v]
add (text) to [copy me!! v]
show list [copy me!! v] //I believe lists are the only thing they let you copy from
the save code would look something like this: 123321§123321§22389§968475§5§4§…

define load save code (save code)
set [i v] to [0]
set [text v] to []
delete all of [split v]
repeat (length of (save code))
if <(letter (i) of (save code)) = [§]> then
add (text) to [split v]
set [text v] to []
else
set [text v] to (join (text) (letter (i) of (save code)))
end
change [i v] by (1)
end
set [units v] to (item (1) of [split v] :: list)
set [chapter v] to (item (2) of [split v] :: list)
set [mode v] to (item (3) of [split v] :: list)
ninja_vex
Scratcher
92 posts

How do i make a save system?

I don't know If anyone is still in this discussion but I have the same that needs to be done accept with an OS
Personthatisnormal
Scratcher
20 posts

How do i make a save system?

ninja_vex wrote:

I don't know If anyone is still in this discussion but I have the same that needs to be done accept with an OS
What is an OS?
ChillyUsername
Scratcher
16 posts

How do i make a save system?

Personthatisnormal wrote:

ninja_vex wrote:

I don't know If anyone is still in this discussion but I have the same that needs to be done accept with an OS
What is an OS?

OS Is An Operating System.
cubetube7
New Scratcher
59 posts

How do i make a save system?

ninja_vex wrote:

I don't know If anyone is still in this discussion but I have the same that needs to be done accept with an OS
why would you need access with the OS? if you mean saving files, you can already do that with right click on list > export
also browsers don't give websites access to the OS either way
Jhunt17
Scratcher
1 post

How do i make a save system?

Anyone know the simplest way?

Powered by DjangoBB