Why aren't the keys recreated in my JSON file?

  • Note: At the beginning the file "Data\System\System.Core" exists with wrong keys....

    I advise you to understand, to delete: "Data\System".

    Just the "System" folder in the "Data" folder.

    I strongly advise you to start the C3 project to understand the code.

    To Test the game directly, go to the "Game" folder.

    If the "Data\System" folder does not exist, it will be automatically recreated.

    Then, if the file "Data\System\System.Core" does not exist, it will be automatically recreated.

    Once the "Data\System\System.Core" file is restored, the keys and values do not exist, so the program will recreate them, everything works fine here) -> OK.

    Close the program and reopen it -> OK.

    Now....

    Close the program, open the "Data\System\System.Core" file, change the keys, for example add characters to existing keys or change the names of the keys, e. g. "Program", put for example "Prosgramz", in short change the keys.

    Restart the program, it will no longer understand anything and so normally it will recreate the keys and values that do not exist, when it is finished, quit, go reopen the file: "Data\System\System.Core".

    Normally, you should notice that not all keys and values have been recreated!

    He's not doing a good job!

    My archive contains two folders: "Projet" and "Jeu"

    "Projet" = C3

    "Jeu" = Test

    drive.google.com/open

  • I had a look at your event sheet and I think you have your events in the wrong order. On layout start you are:

    1. Creating a Dictionary and Array

    2. Saving the Dictionary and Array to the filesystem

    3. Checking if the file exists

    So you will always overwrite the file, even if it exists, before trying to read from it. Instead you should:

    1. Check if the Array/Dictionary exists on the filesystem

    2. If it does then read it and use that data

    3. Otherwise use your default data

  • "1. creation of a dictionary and a table

    2. Save the dictionary and table in the file system

    3. Checking the existence of the file"

    FALSE!

    At the beginning of the scene I check that the "system" folder exists.

    If it doesn't exist, I create it and also create the file "system\système.core".

    If it exists, I check that the "system.core system" folder exists.

    If it doesn't exist, I'll create it!

    I don't have a "Array" object or a "dictionary" object in my project!

    Thank you for reading and answering me!

  • "1. creation of a dictionary and a table

    2. Save the dictionary and table in the file system

    3. Checking the existence of the file"

    FALSE!

    At the beginning of the scene I check that the "system" folder exists.

    If it doesn't exist, I create it and also create the file "system\système.core".

    If it exists, I check that the file "system\système.core" exists.

    If it doesn't exist, I'll create it!

    I don't have a "Table" object or a dictionary object in my project!

    Thank you for reading and answering me!

  • "1. creation of a dictionary and a table

    2. Save the dictionary and table in the file system

    3. Checking the existence of the file"

    FALSE!

    At the beginning of the scene I check that the "system" folder exists.

    If it doesn't exist, I create it and also create the file "system\système.core".

    If it exists, I check that the file "system\système.core" exists.

    If it doesn't exist, I'll create it!

    I don't have a "Table" object or a dictionary object in my project!

    Thank you for reading and answering me!

    Local storage on start of layout check if key "test" exist

    if exist get key "test"

    if missing create key "test"

    etc etc

  • In the project you provided the first set of actions that run belong to the "on start of layout" event, and they are creating table/dictionary data then saving it to file. After that you have a pair of sub events that check the files exist.

    I think either you are looking at a different project, or you misunderstand the order in which actions occur.

    Blocks are labelled in execution order, I removed some set value calls to reduce the size of block 1. Block 1 creates the files. I have highlighted in blue the actions that create the file. Blocks 2 and 3 check the existence of the files. They both occur after the file is written.

  • Sorry, can't understand.

  • Would downl-loading the .c3p file and unzipping it help?

  • Nepeo

    You're talking nonsense!

    You must have taken the wrong file, the wrong subject at all!

    You have confused it with another one of my subjects!

    It doesn't matter.

    Thank you for your attempt to help, but it doesn't help me at all!

    I'm talking about the RPG Game Factory Project, all the files are there!

    I updated the first message.

    My archive contains two folders: "Projet" and "Jeu"

    "Projet" = C3

    "Jeu" = Test

  • So no one knows?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Nepeo

    You're talking nonsense!

    You must have taken the wrong file, the wrong subject at all!

    You have confused it with another one of my subjects!

    It doesn't matter.

    Thank you for your attempt to help, but it doesn't help me at all!

    I'm talking about the RPG Game Factory Project, all the files are there!

    I updated the first message.

    My archive contains two folders: "Projet" and "Jeu"

    "Projet" = C3

    "Jeu" = Test

    dayvid86 Think he/she just telling you to do the actions differently , in what way i do not know but just look over and over again you will figure something out. Have you tried using localstorage instead of nwjs? If it is keys you want to read and write on disc file. Cuz i see you are using AJAX to call , try to JUST use ajax, i mean i do understand your issue just dont have a fix, for me the code should work but i never work with NWJS so id ont know

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)