A
apaydinabdul
Guest
Hello there programmers, I wanted to save the quests progress from my game in a .INI file, to sort of save the progress so you don't have to start from the beginning if you close the game. Now I created and wrote some data to the .INI file, but when I want to read from it, the game returns 0 to the variable I want to set to what's in the .INI file, if you get me.
[STEP EVENT] Here is the code to write something in the file (which works fine):
[CREATE EVENT] Here is the code to read from the file (which the game doesn't read, it returns 0 (as set to default)):
[STEP EVENT] Here is the code to write something in the file (which works fine):
Code:
if (key_quest_start)&&(quest_number = 0)
{
quest_number = 1;
ini_open("player_progress.ini");
ini_write_real("quests","quest_number",1);
ini_close()
}
if (key_quest_start1)&&(quest_number = 1)
{
quest_number = 2;
ini_open("player_progress.ini");
ini_write_real("quests","quest_number",2);
ini_close()
}
if (key_quest_start2)&&(quest_number = 2)
{
quest_number = 3;
ini_open("player_progress.ini");
ini_write_real("quests","quest_number",3);
ini_close()
}
Code:
ini_open("player_progress");
quest_number = ini_read_real("quests","quest_number",0);
ini_close();