From Test-Scratch-Wiki

Veriyi kaydetmek, bir değişkeni veya bir listeyi bir Scratch projesinde kaydetmektir, böylece okunabilir, veya daha sonra kullanılabilir.

Veriyi liste halinde kaydetme

Scratch 1.3 sürümünde listelerin eklenmesiyle birlikte, artık bunu yapmak daha kolaylaştı. Bir listeye sağ tıklanınca listeyi içeriye veya dışarıya aktarma seçenekleri veriliyor. Ve bu da istenen yerde listein .txt dosyasını oluşturuyor.

İyi yanları

Bir oyunda kaldığın yeri kaydedebilmek pek çok oyun geliştiricisi için çok kullanışlı bir özelliktir. Bazı faydaları şunlardır:

  • Oyunu bıraktığın yerden daha sonra yeniden başlayabilmek.
  • Kendi oyun dosyalarını oluşturabilmek.
  • Oluşturanlar projelerini daha kolay bir şekilde güncelleyip değiştirebilir.
  • Oyuncular oyunun belli yönlerini değiştirebilirler.

Kötü yanları

Bir oyunda veriyi kaydetmek çok kullanışlı olsa bile, yine de problemler olabilir:

  • Eğer kod iyi yazılmamışsa, proje doğru çalışmaz.
  • Oyuncular oyunda “hile yapmak” için kolayca .txt dosyasını düzenleyebilir.
  • Oyuncular oyunun değişmemesi gereken özelliklerini değiştirebilir.
  • Scratch’i iyi bilmeyen kullanıcıların kafası karışabilir.

Problemler Nasıl Önlenebilir?

There are several ways to try and prevent the above cons from happening:

  1. Test your save scripts multiple times. Ensure they work under all circumstances.
  2. Make sure that users download your project and not play it online. This can be done with the obsolete block.
  3. You can attempt to encrypt or code your list so that only the computer can decipher your saved data. This, however, is extremely time consuming as well as difficult to do.
  4. Try not to label the items in your save list; labeling them makes it easier for hackers to correctly edit their saves.
  5. You can use a mathematical checker to only allow logical data.
  6. Include detailed instructions on how the game works for new players so that they can understand exactly how to play it.


Farmville V1.5 by dazman

Shaper by jerry1000


Bu öğretici bir listede değerleri kaydeden basit bir sistem yapmayı gösterecek.

All the data will be stored in a single string which will be put back into the project at a later date to load the old data the player had.

To start, make a list called "Save Data". Next, make the following custom block which will save data:

tanımla kaydet (değer)
((değer) ve [;] 'i birleştir) i [Veri Kaydet v] ye ekle

You can then make a script to save any variables you want:

kaydet (x pozisyonu) :: custom-arg
kaydet (can) :: custom-arg
kaydet (para) :: custom-arg

The next step is to give the save code to the user so they can enter it in later. First you want to make a variable called code. You can do so like this:

[kod v] i [] yap // İkinci girdinin boş olduğundan emin olun
<([Veri Kaydet v] 'in uzunluğu) = [0]> olana kadar tekrarla 
  [kod v] i ((kod) ve ([Veri Kaydet v] nin (1 v) öğesi) 'i birleştir) yap
  [Veri Kaydet v] nin (1 v) ini sil
(kod) i [Veri Kaydet v] ye ekle
[Veri Kaydet v] listesini göster

The user can then export the list or copy and paste the code somewhere.

Finally, the user needs to be able to load data. Make a list called "Loaded Data" and a variable called "i", then make the following custom block:

tanımla veri yükle (veri)
[i v] i [1] yap
[değer v] i [] yap // İkinci girdinin boş olduğundan emin olun
<(i) > ((veri) 'in uzunluğu)> olana kadar tekrarla 
  <((veri) in (i) . harfi) = [;]> olana kadar tekrarla 
    [değer v] i ((değer) ve ((veri) in (i) . harfi) 'i birleştir) yap
    [i v] i (1) kadar değiştir
  (değer) i [Yüklenmiş Veri v] ye ekle
  [i v] i (1) kadar değiştir
  [değer v] i [] yap // İkinci girdinin boş olduğundan emin olun

Now you simply need to load the data in the order that you saved it. You first ask the player for their save code, then load the data, and then store the loaded data. So for the above example where "x position" is stored, then "health", then "money". The loading script would look like this:

[Save code?] diye sor ve bekle
veri yükle (cevap) :: custom-arg
x konumunu ([Yüklenmiş Veri v] nin (1 v) öğesi) yap
[can v] i ([Yüklenmiş Veri v] nin (2 v) öğesi) yap
[para v] i ([Yüklenmiş Veri v] nin (3 v) öğesi) yap

If you get lost you can look here for help:

Şifreleme ile Veri Kaydetme

Another method for saving data in Scratch is through the use of . With this method, the user is prompted to enter a code when the game starts and is given a new code when he or she wishes to leave. These codes can be used to determine where in the game players left off. For example, let's say that you were playing a scrolling game and you had 2 lives left and 5 cash. When you saved the game, you would get a code of 25. When you resumed the game, it would set your lives to the first letter of the code and set your cash to the second letter.


This method of saving your game can be just as effective, if not more effective than the first method listed. Here are some benefits of this method as compared to it:

  • It works online and offline.
  • Codes can be used on any computer.
  • The scripts are simpler.


Although this method is a great way to save games, it does have quite a few cons:

  • The player has to remember or write down the code. This can be very annoying for the player as some advanced games could involve codes with as many as 20-30 characters!
  • Unless you have great experience with encrypting and decrypting files, your codes may be very easy to crack. This can allow players to modify their saves with ease.
  • Players may share "cracked" codes with other players, allowing others to cheat on your game.
  • This method is difficult to use in situations involving numbers with a wide range. A player's money could reach heights of millions, so programming a script that would understand how to deal with any value for these numbers could be very tedious and time consuming.

How to Prevent Problems

  1. Try to make codes as short as possible or show the code in a list so users can copy and paste the code.
  2. Leave instructions on how to use the code in the project notes.
  3. Encrypt your codes.
  4. Have all valid codes fall under a single mathematical equation and all codes checked with it - some false codes may go against the equation and will therefore not be accepted.
  5. Make sure that your scripts will work for very long codes with a range of values.


SAvegame test by kwickgamer

Saving Data in Variables

Another method to save data is through variables. When you save your project, all the current variable values are saved. This is one of the most popular methods as it is easy and straight forward. It is easy for the player to save their progress. The project creator although, has to create a way to initiate the saved variables when the game starts.


This method is most commonly used because:

  • It is quick and easy for the player.
  • It is easy for the Scratcher to do, even with little knowledge.


Despite how easy it might seem, this method has a con: It cannot be used on online project players.

How to Prevent Problems

  1. Try to "hide" your variables so people will not try and change them
  2. Use a mathematical checker so that people do not change the variables.
  3. Make sure that your project calls on the variables before the game starts, so that the data is properly restored.
  4. Test the project to ensure that this method works with your project and the code works to restore a saved game.


SynOS 7: Purple Crystal by 08jackt

Saving Data in the Cloud

Main article: Cloud Data
See also: Global High Scores

Cloud data is stored in the "cloud", or on the Scratch server, meaning it is stored on the web. Cloud data does not reset when you view a project; it gets globally updated by anyone changing the cloud variable. For example, if User A views a project and changes the variable from "1" to "2", when User B views the project, the variable will stay as "2". The variables globally update, with the speed of typically 2 seconds with a Firewall on to update the value. Storing data on the cloud is difficult, as Scratch 2.0 has disabled strings to be saved on cloud temporarily.

This is typically accomplished by creating two cloud lists. The first is a list of users who have stored data. The second is a list with the saved data, corresponding to the users in list number 1.


  • No need to remember or write down any codes or encrypted text.
  • Data can be loaded back after clicking the green flag.
  • Data can be stored separately for each individual Scratcher


  • Eğer bulut veri herhangi bir sebepten dolayı kaybolmuşsa, tüm kayıtlar gidecektir.
  • Kaç tane kişinin kullanabileceğine dair bir limit var.
  • Bulut veri kullanmak kafa karıştırıcı olabilir.

Problemler Nasıl Önlenebilir?

  1. Test out the cloud data system, before publishing a project with cloud saving in it.
  2. Include a back-up variable to store information on.
Cookies help us deliver our services. By using our services, you agree to our use of cookies.