LoginLogin

How to store multiple variables in a .DAT file?

Root / Programming Questions / [.]

BlackDrag0n23Created:
I need help creating save data for a game I'm making and it needs to store multiple variables. I haven't programmed in a while so I'm a little rusty.

You can use something called an array. It's basically a list of variables. You can store numbers in an array with something like:
MAXIMUM=3 'maximum number of variables
DIM ARRAY[MAXIMUM]
ARRAY[0]=1
ARRAY[1]=6
ARRAY[2]=4
Then all you need to do is save the array in a DAT file.
SAVE "DAT:NAME",ARRAY

How would I call the numbers from an array in to variables? EDIT: Would it be something like:
VARIABLE=ARRAY[9]

How would I call the numbers from an array in to variables? EDIT: Would it be something like:
VARIABLE=ARRAY[9]
Yip!