I'm not sure how Construct 3 saves and loads files exactly. Essentially I created a JSON file called "keyconfig.json" that has a few lines of data where the key name is the name of the button and the value is the KEYBOARD keycode that I want. I so far have code working to grab those values and assign them to in-game variables and I have code that changes the JSON values when you change stuff in the keyconfig prompt. But it is only temporary, if you close and reopen the game all of the JSON values are reset to their initial value. How can I make construct SAVE the data to the JSON file permanently?
You can't rewrite the project file.
The most common solution is to save the new JSON info in Local Storage. Then, when your game starts, check Local Storage - if it contains new keyconfig, load it from Local Storage. If not - use AJAX to request the default values from JSON file.
dop2000 how do I save a json file in local storage, local storage is like a dictionary I thought.
Kind of, but it allows to save the data permanently.
When you need to save the new keyconfig -
Local Storage Set "custom_keyconfig" to JSON.ToCompactString
On start of layout:
Local Storage Check if item "custom_keyconfig" exists
Local Storage if item "custom_keyconfig" exists
JSON parse from LocalStorage.itemData
Local Storage if item "custom_keyconfig" missing
AJAX request project file....
Develop games in your browser. Powerful, performant & highly capable.
That worked thanks a ton