#Saving 2D Arrays and load them

2 messages · Page 1 of 1 (latest)

jade obsidian
#

Hello i store Items info in a "global.food" which is a 2D Array filled with Foodtypes for example. global.food[fries,hotwings]
fires = [0,false,1000]
hotwings = [1,true,2000] and so on.
How can i save them in a ini file without having to save all datatypes by it self and load them? Or is there a better thing to do with storing those kind of data and if yes how?

eternal mirage
# jade obsidian Hello i store Items info in a "global.food" which is a 2D Array filled with Food...

You can't save them to ini unless if you loop through them and save them individually.

I'd recommend using jsons, as json allows you to save the entire array as is. You can check out this tutorial on the basics on how to do it:
https://youtu.be/R84mR52QaMg?si=PXPCnC15mIUR7a8g

Like the other tutorial I did, only better. A universal approach for when you need to save or load data in GameMaker, using JSON, structs and arrays.

▶ Source code: https://www.patreon.com/posts/44109513
▶ Support my work: https://www.patreon.com/shaunjs
▶ This same tutorial for older versions of GameMaker: https://www.youtube.com/watch?v=QmxQb...

▶ Play video