Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
gdevelop5:tutorials:storage-action-explained [2019/01/24 18:57]
4ian
gdevelop5:tutorials:storage-action-explained [2019/07/03 19:14] (current)
ddabrahim
Line 10: Line 10:
 ==== Write value ==== ==== Write value ====
  
-**File:** "filename"+**Storage:** "storagename"
  
-Name of the file you want to write in to. For example, you may want to store player information in a file called "​player"​ and game settings in a file called "​settings"​ or you can just use a single ​file to save everything and call it "​save"​ it is up to you how would you like to organize this. If the file with the name does not exists, GDevelop ​going to create the file+Name of the storage ​you want to write a value in to. For example, you may want to store player information in a storage ​called "​player"​ and game settings in a storage ​called "​settings"​ or you can just use a single ​storage ​to save everything and call it "​save"​ it is up to you how would you like to organize this. If the storage ​with the name does not exist, GDevelop ​will create the storage
-<note important>​In case of HTML5, GDevelop is not using the local file system, instead it using the web storage to store the file</​note>​+<note important>​In case of HTML5, GDevelop is not using the local file system, insteadit uses the web storage to store data</​note>​
  
  
 **Group:** "Group name" **Group:** "Group name"
  
-can be anything, this is basically a name that you going to assign the value to inside the file. By using groups, you can store multiple values in the same file. For example, the position of the player can be stored within a group and life of the player can be stored within another group inside the same file like so:+can be anything, this is basically a name that you'​re ​going to assign ​to the valueinside the storage. By using groups, you can store multiple values in the same storage. For example, the position of the player can be stored within a group and the life of the player can be stored within another group inside the same storage, ​so:
  
 Group: "​PlayerPositionX"​ to store the X position of the player Group: "​PlayerPositionX"​ to store the X position of the player
Line 24: Line 24:
 Group: "​PlayerLife"​ to store the life of the player Group: "​PlayerLife"​ to store the life of the player
  
-When you load the value from the file, you can use the group name to specify what value you want to read from the file. The X Position of the player or the life or anything else.+When you load the value from the storage, you can use the group name to specifywhat value you want to read from the storage - in the above case, it can be the X Position of the player or the life or some other value stored in the storage.
  
-**Expression:​** the value you want to write into the file+**Expression:​** the value you want to write into the storage
  
 can be anything, a number such as 12345 or text such as "this is text" or even a variable. can be anything, a number such as 12345 or text such as "this is text" or even a variable.
Line 34: Line 34:
 **Object variable:** **Object variable:**
  
-object_name.Variable(variable_name)+object\_name.Variable(variable\_name)
  
-object_name.VariableString(variable_name)+object\_name.VariableString(variable\_name)
  
 **Scene variable:** **Scene variable:**
  
- ​Variable(variable_name)+ ​Variable(variable\_name)
  
- ​VariableString(variable_name)+ ​VariableString(variable\_name)
  
 **Global variable:​** ​ **Global variable:​** ​
  
-GlobalVariable(variable_name)+GlobalVariable(variable\_name)
  
-GlobalVariableString(variable_name)+GlobalVariableString(variable\_name)
  
-An important thing you need to keep in mind**Write Value** can be used only to write number and **Write Text** can be used only to write text into the file and you need to keep this in mind when you using the expressions ​too. The ones with a** String** in the expressions are for calling text variables and the ones without it are for calling number variables.+An important thing you need to keep in mind is that **"Write Value" ​can be used only to write number** and **"Write Text" ​can be used only to write text** into the storage, ​and you need to keep this in mind even when you'​re ​using the expressions. The ones with a "String" ​in the expressions are for calling text variables and the ones without it are for calling number variables.
  
 ==== Read value ==== ==== Read value ====
  
-To Read a value from a file, basically the same thing:+To Read a value from a storageyou need to do basically the same thing:
  
-**File:** Enter name of the file you want to read from+**Storage:** Enter name of the storage ​you want to read from
  
-**Group:** enter the name of the group that has the value in the file+**Group:** enter the name of the group that has the value in the storage
  
-**Scene Variable:** enter the variable name you wish to use to load the value in toIt is important to be a scene variable and this field expecting ​the actual name of the variable and not an expression. The variable also needs to be added to the variable list in the scene properties ​and select ​the variable from the list. In case you want to store the value inside a global or object variable, ​just use the scene variable to pass the value over to a global or object variable after reading from the file.+**Scene Variable:** enter the variable name you wish to use to load the value intoPlease note, that **it should ​be a scene variable** and this field expects ​the actual name of the variable and not an expression. The variable also needs to be added to the variable list in the scene properties ​followed by selecting ​the variable from the list. In caseyou want to store the value inside a global or object variable, ​you can use the scene variable to pass the value over to a global or object variable after reading from the storage.
  
-And again, **Read Value** is to read number only and **Read Text** is to read text only. You also need to keep this in mind when you select the scene variable to read the value in to. The variable ​need to be number to store number and text to store text.+And again, **"Read Value" ​is to read number only** and **"Read Text" ​is to read text only**. You also need to remember ​this when you select the scene variableto read the value into. The variable ​has to be number ​variable ​to store number and text variable ​to store text.
  
 === Examples === === Examples ===