This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2010-07-19 19:09:58

murpho
Scratcher
Registered: 2010-07-01
Posts: 1000+

How do I make a in game save/load function

I want to make a save/load function because i plan on making a long game so i want those that play can save their progress. Do you know how i can do that?


https://lh6.googleusercontent.com/-l-rgCPiQ9pY/Tp32n1MRUEI/AAAAAAAADoA/HNQWbO8OOaA/s510/soccerleague.gif

Offline

 

#2 2010-07-19 19:16:40

meowmeow55
Scratcher
Registered: 2008-12-24
Posts: 1000+

Re: How do I make a in game save/load function

You can make save slots by making lists. In each list, the items in the list can be set to variables like level number, checkpoint, items, x/y pos (unless you don't want to go that far), etc.


Yawn.

Offline

 

#3 2010-07-19 19:23:23

hmnwilson
Scratcher
Registered: 2007-07-04
Posts: 1000+

Re: How do I make a in game save/load function

Sorry, but a real save/load script is impossible at the moment.

You still have options, though. The best way is to use a password system. Every time you hit a certain point you can give the player a new password, and then make it so that they can enter the password before starting the game. You can even make it calculate the password in-game!

Another more complicated way is to use lists, but unfortunately, the game must be downloaded first. Basically, you'd add all the important information to a list, and then tell the player to click the "save" button at the top of the program, so that it's there when you open the game again. Then, when you press the green flag, it would use all that information to bring you back to where you were!

It's more difficult than just having blocks to automatically save, but it's still possible. Good luck!

Last edited by hmnwilson (2010-07-19 19:24:01)


I'm taking a break from Scratch until 2.0 comes out. Any messages sent between then and now probably won't be read - sorry.
(Oct. 20, 2011)

Offline

 

#4 2010-07-19 19:24:12

murpho
Scratcher
Registered: 2010-07-01
Posts: 1000+

Re: How do I make a in game save/load function

can you show me the script with the blocks


https://lh6.googleusercontent.com/-l-rgCPiQ9pY/Tp32n1MRUEI/AAAAAAAADoA/HNQWbO8OOaA/s510/soccerleague.gif

Offline

 

#5 2010-07-19 19:29:10

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: How do I make a in game save/load function

hmnwilson wrote:

Sorry, but a real save/load script is impossible at the moment.

Uhhh..no it's not, I've made a script that saves and loads a game, including the pen. (I never uploaded it if you're wondering)


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#6 2010-07-19 19:33:13

Corbinsor
Scratcher
Registered: 2010-07-13
Posts: 16

Re: How do I make a in game save/load function

All you people, He's looking for a BLOCKIFIED POST!!!

Offline

 

#7 2010-07-19 19:35:02

murpho
Scratcher
Registered: 2010-07-01
Posts: 1000+

Re: How do I make a in game save/load function

ScratchReallyROCKS wrote:

hmnwilson wrote:

Sorry, but a real save/load script is impossible at the moment.

Uhhh..no it's not, I've made a script that saves and loads a game, including the pen. (I never uploaded it if you're wondering)

can you please tell me how it would be great


https://lh6.googleusercontent.com/-l-rgCPiQ9pY/Tp32n1MRUEI/AAAAAAAADoA/HNQWbO8OOaA/s510/soccerleague.gif

Offline

 

#8 2010-07-19 20:35:34

vortex19
Scratcher
Registered: 2009-06-03
Posts: 100+

Re: How do I make a in game save/load function

murpho wrote:

can you show me the script with the blocks

I think this is the script you're looking for:


<when I receive[ save game
delete "all" on list "save list"
add <x position> to "save list"
add <y position> to "save list"
add <{ Score }> to "save list"
etc.


And when you load the game...


<when I receive[ load game
<set x to( item 1 on "save list" )>
<set y to( item 2 on "save list" )>
<set{ Score }to( item 3 on "save list" )>
etc.


However, this only works offline and if you save the project after you activate the save script.

Offline

 

#9 2010-07-20 09:14:54

Scratchthatguys
Scratcher
Registered: 2010-07-16
Posts: 1000+

Re: How do I make a in game save/load function

<when green flag clicked>
<forever>
<if><< mouse touching save <and>and mouse down
<set{savedx }to(<x position>
<set{savedy }to( <y position>
<set{savedd }to( <direction>
<stop script> >>
is my save script, and
<when green flag clicked>
<forever>
<go to x sad  savedx )y sad  savedy
<point in direction( savedd
<stop script>
was my load script.

Offline

 

#10 2010-07-20 10:19:11

murpho
Scratcher
Registered: 2010-07-01
Posts: 1000+

Re: How do I make a in game save/load function

thank you this really helps!!!


https://lh6.googleusercontent.com/-l-rgCPiQ9pY/Tp32n1MRUEI/AAAAAAAADoA/HNQWbO8OOaA/s510/soccerleague.gif

Offline

 

#11 2010-07-20 10:35:58

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: How do I make a in game save/load function

murpho wrote:

ScratchReallyROCKS wrote:

hmnwilson wrote:

Sorry, but a real save/load script is impossible at the moment.

Uhhh..no it's not, I've made a script that saves and loads a game, including the pen. (I never uploaded it if you're wondering)

can you please tell me how it would be great

I'll upload something...


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#12 2010-07-20 11:35:26

murpho
Scratcher
Registered: 2010-07-01
Posts: 1000+

Re: How do I make a in game save/load function

thank you. and thank you Scratchthatguys i'm working on it right now and i'm so excited to see if it works.


https://lh6.googleusercontent.com/-l-rgCPiQ9pY/Tp32n1MRUEI/AAAAAAAADoA/HNQWbO8OOaA/s510/soccerleague.gif

Offline

 

#13 2010-07-20 12:49:29

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: How do I make a in game save/load function

ScratchReallyROCKS wrote:

murpho wrote:

ScratchReallyROCKS wrote:


Uhhh..no it's not, I've made a script that saves and loads a game, including the pen. (I never uploaded it if you're wondering)

can you please tell me how it would be great

I'll upload something...

Okay, I finished it: here it is


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#14 2010-07-20 22:13:16

murpho
Scratcher
Registered: 2010-07-01
Posts: 1000+

Re: How do I make a in game save/load function

its perfect ill save it!! thanks!!the only problem is you have  to delete the old one!


https://lh6.googleusercontent.com/-l-rgCPiQ9pY/Tp32n1MRUEI/AAAAAAAADoA/HNQWbO8OOaA/s510/soccerleague.gif

Offline

 

#15 2010-07-26 00:59:40

MabonBaladevaKain
Scratcher
Registered: 2010-07-25
Posts: 80

Re: How do I make a in game save/load function

I'm NEW to Scratch, so this is both a question and an answer:

Can alterable values of some sort be used online?
Cause if so, you could just make checkpoints throughout the level,
and when you touch the checkpoints, set the alterable values to the current
x and y positions and the current level.

Offline

 

#16 2010-07-26 01:14:13

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: How do I make a in game save/load function

MabonBaladevaKain wrote:

I'm NEW to Scratch, so this is both a question and an answer:

Can alterable values of some sort be used online?
Cause if so, you could just make checkpoints throughout the level,
and when you touch the checkpoints, set the alterable values to the current
x and y positions and the current level.

By "alterable values," do you mean variables? Because yes, Scratch has those. But I think what he is looking for is more of a way to close the game and load progress later than a checkpoint system.


http://www.blocks.scratchr.org/API.php?action=random&amp;return=image&amp;link1=http://i.imgur.com/OZn2RD3.png&amp;link2=http://i.imgur.com/duzaGTB.png&amp;link3=http://i.imgur.com/CrDGvvZ.png&amp;link4=http://i.imgur.com/POEpQyZ.png&amp;link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#17 2010-07-26 01:14:27

cheddargirl
Scratch Team
Registered: 2008-09-15
Posts: 1000+

Re: How do I make a in game save/load function

MabonBaladevaKain wrote:

I'm NEW to Scratch, so this is both a question and an answer:

Can alterable values of some sort be used online?
Cause if so, you could just make checkpoints throughout the level,
and when you touch the checkpoints, set the alterable values to the current
x and y positions and the current level.

You sure can!  smile 

If you open up Scratch, you will notice that the Scratch blocks can be broken down into smaller groups (Motion, Looks, Sound, etc.). One of them is called Variables. You can click on that and choose the option 'Make a variable', which will create a variable block, plus another set of blocks that can be used to change the value of the variable.  smile


http://i.imgur.com/8QRYx.png
Everything is better when you add a little cheddar, because when you have cheese your life is at ease  smile

Offline

 

#18 2010-08-10 19:51:01

Thomas96
Scratcher
Registered: 2010-03-25
Posts: 100+

Re: How do I make a in game save/load function

vortex19 wrote:

I think this is the script you're looking for:


<when I receive[ save game
delete "all" on list "save list"
add <x position> to "save list"
add <y position> to "save list"
add <{ Score }> to "save list"
etc.


And when you load the game...


<when I receive[ load game
<set x to( item 1 on "save list" )>
<set y to( item 2 on "save list" )>
<set{ Score }to( item 3 on "save list" )>
etc.

Scratchthatguys wrote:

<when green flag clicked>
<forever>
<if><< mouse touching save <and>and mouse down
<set{savedx }to(<x position>
<set{savedy }to( <y position>
<set{savedd }to( <direction>
<stop script> >>
is my save script, and
<when green flag clicked>
<forever>
<go to x sad  savedx )y sad  savedy
<point in direction( savedd
<stop script>
was my load script.

However, this only works offline and if you save the project after you activate the save script.

f the project was to be compiled to an .exe file would the permanent saving work?

Offline

 

#19 2010-08-10 22:43:59

murpho
Scratcher
Registered: 2010-07-01
Posts: 1000+

Re: How do I make a in game save/load function

This is a very old topic actually. I learned how to make this on my own


https://lh6.googleusercontent.com/-l-rgCPiQ9pY/Tp32n1MRUEI/AAAAAAAADoA/HNQWbO8OOaA/s510/soccerleague.gif

Offline

 

#20 2010-08-11 10:19:06

Thomas96
Scratcher
Registered: 2010-03-25
Posts: 100+

Re: How do I make a in game save/load function

If it were to be compiled, would the save file, save, and load after the game has been exited?

Offline

 

#21 2010-08-19 17:09:14

trekkie2000
Scratcher
Registered: 2009-02-15
Posts: 100+

Re: How do I make a in game save/load function

Its acutally possible, and really easy. All you have to do is eliminate anything that says "When Flag pressed, set all variables to 0" because that will restart the game. Instead, make something ingame that allows you to optionally clear your stats if they wont to retry. Then, before you share the project, press the restart.


"If life gives you lemons, sell lemonade for $.25...
...Sell antidote to poison in lemonade for $250" -Me

Offline

 

#22 2010-08-20 19:19:33

Scratchthatguys
Scratcher
Registered: 2010-07-16
Posts: 1000+

Re: How do I make a in game save/load function

murpho wrote:

thank you. and thank you Scratchthatguys i'm working on it right now and i'm so excited to see if it works.

your welcome XD i also made a 3d engine and a few other games that i will add a save and load system. In fact, I may use everyones ideas for my ScratchXP OS.  wink  help appreciated!

Offline

 

#23 2010-08-20 23:28:43

murpho
Scratcher
Registered: 2010-07-01
Posts: 1000+

Re: How do I make a in game save/load function

i learned on my own


https://lh6.googleusercontent.com/-l-rgCPiQ9pY/Tp32n1MRUEI/AAAAAAAADoA/HNQWbO8OOaA/s510/soccerleague.gif

Offline

 

#24 2010-08-21 08:38:00

trekkie2000
Scratcher
Registered: 2009-02-15
Posts: 100+

Re: How do I make a in game save/load function

So if the topic's closed, should we get a Moderator?


"If life gives you lemons, sell lemonade for $.25...
...Sell antidote to poison in lemonade for $250" -Me

Offline

 

#25 2010-08-21 12:12:59

murpho
Scratcher
Registered: 2010-07-01
Posts: 1000+

Re: How do I make a in game save/load function

ya


https://lh6.googleusercontent.com/-l-rgCPiQ9pY/Tp32n1MRUEI/AAAAAAAADoA/HNQWbO8OOaA/s510/soccerleague.gif

Offline

 

Board footer